private void onInstall(object sender, EventArgs e) { if (LicenseFile.Text == null || LicenseFile.Text == "") { MessageBox.Show("Please select valid license file", "Failed", MessageBoxButtons.OK); return; } try { String destFile = System.IO.Path.Combine(LicenseManager.LicenseDir, "license.lic"); // To copy a file to another location and // overwrite the destination file if it already exists. System.IO.File.Copy(LicenseFile.Text, destFile, true); LicenseManager.Validate(); if (LicenseManager.Valid) { MessageBox.Show("License installed and validated successfully", "Success", MessageBoxButtons.OK); this.Close(); } else { MessageBox.Show("License validation failed", "Failed", MessageBoxButtons.OK); } } catch { MessageBox.Show("License installation failed", "Failed", MessageBoxButtons.OK); } }
void timerTick(object sender, EventArgs e) { timer.Interval = interval; // validate license LicenseManager.Validate(); if (!LicenseManager.Valid) { MessageBox.Show("License validation failed", "Failed", MessageBoxButtons.OK); this.Close(); } }
static void Main() { bool createdNew; Mutex m = new Mutex(true, "XcheckStudio-HubManager.exe", out createdNew); if (!createdNew) { MessageBox.Show("XcheckStudio-HubManager.exe is already running!", "Multiple Instances"); return; } /// Check license bool success = LicenseManager.Validate(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); mainForm = new MainForm(); Application.Run(mainForm); }