/
MainWindow.xaml.cs
67 lines (55 loc) · 1.8 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System.Windows;
namespace kms_activate
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
// Must be admin
if (!Util.IsAdmin())
{
MessageBox.Show("You have to perform this action as Admin!", "Privilege escalation required!", MessageBoxButton.OK, MessageBoxImage.Stop);
Application.Current.Shutdown();
}
InitializeComponent();
windows_option.IsChecked = true;
ShowDebug.IsChecked = true;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
// when to exit
if (button.Content.ToString() == "Done! Click to exit")
{
Application.Current.Shutdown();
}
// Disable all buttons
button.Content = "Please wait...";
button.IsEnabled = false;
windows_option.IsEnabled = false;
office_option.IsEnabled = false;
ShowDebug.IsEnabled = false;
// Try to activate
Util.KMSActivate();
}
private void Windows_option_Checked(object sender, RoutedEventArgs e)
{
ActWin.WinEnv();
}
private void Office_option_Checked(object sender, RoutedEventArgs e)
{
ActOffice.OfficeEnv();
}
private void TextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
}
private void TextBox_TextChanged_1(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
}
}
}