Example #1
0
        // gets Windows edition and current product key, updates GUI with available actions
        private async Task <bool> Step1Update()
        {
            // windows edition
            string s = await Task.Run(
                () => {
                return(LicensingHelper.GetWindowsSKU());
            });

            // current product key
            string oldkey = await Task.Run(
                () => {
                return(LicensingHelper.GetProductKey());
            });

            step1output.Text = s;

            // update gui
            if (s != null)
            {
                string key = SkuToProductKey.Get(s);
                if ((key != null && !key.Equals(oldkey)) || key == null)
                {
                    step1action.Text     = "Action: backup current key and install VL key.";
                    previousStepEnabled |= step1.Enabled = true;
                }
                else
                {
                    step1action.Text = "No action necessary: VL key is installed.";
                    step1.Enabled    = false;
                }
            }

            return(true);
        }
Example #2
0
        private async void InstallKey_Click(object sender, EventArgs e)
        {
            Enabled = false;

            MessageBox.Show(
                "JAW will now uninstall all product keys and install the correct one. This should " +
                "take a few seconds, but on particularly slow systems it could take a few minutes.",
                "Software Licensing Service"
                );

            string sku = LicensingHelper.GetWindowsSKU();
            string key = SkuToProductKey.Get(sku);

            if (key == null)
            {
                using (InputBox keyInput = new InputBox())
                {
                    keyInput.ShowDialog();
                    if (keyInput.InputValid)
                    {
                        key = keyInput.Input;
                        SkuToProductKey.SetOverrideKey(key);
                    }
                    else
                    {
                        MessageBox.Show(
                            "The Product key you've inserted is not valid.",
                            "Product key invalid."
                            );
                        Enabled = true;
                        return;
                    }
                }
            }

            LicensingHelper.SetProductKey(key);

            await UpdateGui();

            Enabled = true;
        }