Exemple #1
0
        public InstallKmsKeys(MainWindow mainWindow, LicenseMachine machine) : base(mainWindow)
        {
            bool isWindowsActivated;

            this.machine = machine;
            InitializeComponent();
            DataContext = this;
            TopElement.LayoutTransform = Scaler;

            Loaded += (s, e) =>
            {
                machine.GetKmsLicenses(out isWindowsActivated, kmsLicenses);
                DataGrid.ItemsSource = kmsLicenses;
                DataGrid.Items.SortDescriptions.Add(new SortDescription(nameof(KmsLicense.DisplayName), ListSortDirection.Ascending));

                if (!isWindowsActivated)
                {
                    var firstWindowsLicense = kmsLicenses.FirstOrDefault(l => l.ApplicationID == Kms.WinGuid);
                    if (firstWindowsLicense != null)
                    {
                        firstWindowsLicense.IsRadioButtonChecked = true;
                    }
                }

                foreach (var kmsLicense in kmsLicenses.Where(l => l.ApplicationID != Kms.WinGuid))
                {
                    kmsLicense.IsCheckBoxChecked = kmsLicense.IsNotActivated;
                }

                Install_Click(s, e);
            };
        }
Exemple #2
0
 public static void PopulateLicenseMachine()
 {
     PopulateLicense();
     licMac    = new LicenseMachine[1];
     licMac[0] = new LicenseMachine {
         DeviceId = "12313424", License = lic[0]
     };
 }
 public ServiceConfiguration(LicenseMachine machine, LicenseMachine.LicenseProvider licenseProvider, UIElement icon)
 {
     this.licenseProvider = licenseProvider;
     this.machine         = machine;
     InitializeComponent();
     MainGrid.LayoutTransform = Scaler;
     Title   = $"{licenseProvider.FriendlyName} {licenseProvider.Version} Settings";
     Loaded += (s, e) => Icon = this.GenerateImage(icon, 16, 16);
 }
 public ConnectForm(MainWindow parent)
 {
     this.parent = parent;
     machine     = this.parent.Machine;
     InitializeComponent();
     TopElement.LayoutTransform   = Scaler;
     parent.LabelStatus.Text      = "Getting Computer Name";
     ButtonConnectLocal.IsEnabled = machine.ComputerName != ".";
 }
Exemple #5
0
        public void DisplayPropertyAsLicenseStatus(IEnumerable <Control> controls, TextBox textBox)
        {
            Property = "LicenseStatus";
            if (!(Value is uint))
            {
                Hide(controls, textBox);
                textBox.Text = "N/A";
            }
            try
            {
                var licenseStatus       = (uint)Value;
                var licenseStatusString = LicenseMachine.LicenseStatusText(licenseStatus);

                switch (licenseStatus)
                {
                case 0:
                case 5:
                    textBox.Background = Brushes.OrangeRed;
                    break;

                case 1:
                    textBox.Background = Brushes.LightGreen;
                    break;

                default:
                    textBox.Background = Brushes.Yellow;
                    break;
                }

                Property = "LicenseStatusReason";

                if (Value != null)
                {
                    licenseStatusString += ": " + Kms.StatusMessage((uint)Value);
                }

                textBox.Text = licenseStatusString;
                Show(controls, textBox);
            }
            catch
            {
                Hide(controls, textBox);
                textBox.Text       = "N/A";
                textBox.Background = App.DefaultTextBoxBackground;
            }
        }