private void LoadProperties() { MyPropertyManager.OnLoad(); /////////// exp_level /////////// if (MyPropertyManager.GetProperty("Difficulty") != null) { cboExpLevel.SelectedItem = (string)MyPropertyManager.GetProperty("Difficulty"); } else { cboExpLevel.SelectedIndex = 0; } SetDifficulty(); this.cboExpLevel.SelectedIndexChanged += new System.EventHandler(this.cboExpLevel_SelectedIndexChanged); /////////// thread_count /////////// if (MyPropertyManager.GetProperty("ThreadCount") != null) { mnuThreadCount.SelectedIndex = (int)MyPropertyManager.GetProperty("ThreadCount") - 1; } else { mnuThreadCount.SelectedIndex = 0; } SetThreadCount(); this.mnuThreadCount.SelectedIndexChanged += new System.EventHandler(this.mnuThreadCount_SelectedIndexChanged); }
private bool LoadCheckLicense() { bool IsValid = false; Licensing.LicenseResponse resp = new Licensing.LicenseResponse(); try { MyPropertyManager.OnLoad(); //call only once !!! string LocalTID = (string)MyPropertyManager.GetProperty("TID"); try { Microsoft.Win32.RegistryKey key; key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("YTRLicense", true); if (key == null) { key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("YTRLicense"); } else { LocalTID = key.GetValue("tid") == null ? "" : key.GetValue("tid").ToString(); } key.Close(); } catch { } if (LocalTID.Length > 0) { Task.Factory.StartNew(() => { Thread.Sleep(100); }); SetMessage("Checking license...", Color.Black);; Http request = new Http(); resp = Licensing.CheckLicense(request, LocalTID); } else { pLicense.Invoke((MethodInvoker) delegate { pLicense.Visible = true; }); SetMessage("Enter your License ID " + Environment.NewLine + "and Click 'Verify'", Color.Black); } IsValid = resp.IsValid; if (!IsValid) { SetMessage(resp.Message, resp.color); pLicense.Invoke((MethodInvoker) delegate { pLicense.Visible = true; }); } } catch (Exception) { MessageBox.Show("Error SF100. Please contact support [email protected]."); return(false); } return(IsValid); }
private void mnuThreadCount_SelectedIndexChanged(object sender, EventArgs e) { MyPropertyManager.SetProperty("ThreadCount", int.Parse(mnuThreadCount.SelectedItem.ToString())); SetThreadCount(); }
private void cboExpLevel_SelectedIndexChanged(object sender, EventArgs e) { MyPropertyManager.SetProperty("Difficulty", cboExpLevel.SelectedItem); SetDifficulty(); }