public override bool Next() { try { switch (ActivationType) { case ActivationTypes.Email: ParentForm.Cursor = Cursors.Default; frmLicenseWizard.Result = ScreenStart.Actions.None; frmLicenseWizard.CloseWizard(); break; case ActivationTypes.ExtendTrial: string message; if (SlyceAuthorizer.ActivateManually("", out message)) { MessageBox.Show("ArchAngel trial has been successfully extended.", "Trial Extended", MessageBoxButtons.OK, MessageBoxIcon.Information); ParentForm.Cursor = Cursors.Default; frmLicenseWizard.Result = ScreenStart.Actions.Activate; frmLicenseWizard.CloseWizard(); } else { MessageBox.Show(message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case ActivationTypes.Website: if (File.Exists(txtLicenseFile2.Text)) { // User has downloaded a license file if (SlyceAuthorizer.ActivateManually(txtLicenseFile2.Text, out message)) { MessageBox.Show("License successfully installed!", "Activation Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); ParentForm.Cursor = Cursors.Default; frmLicenseWizard.Result = ScreenStart.Actions.Activate; frmLicenseWizard.CloseWizard(); return(true); } MessageBox.Show("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } ParentForm.Cursor = Cursors.Default; frmLicenseWizard.CloseWizard(); break; default: MessageBox.Show("Not handled yet: " + ActivationType.ToString()); break; } return(false); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); return(false); } }
private void buttonInstallLicenseFile_Click(object sender, System.EventArgs e) { if (!File.Exists(textBoxLicenseFile.Text)) { MessageBox.Show("License file not found.", "Invalid License File", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string message; if (SlyceAuthorizer.ActivateManually(textBoxLicenseFile.Text, out message)) { SlyceAuthorizer.Reset(); int daysRemaining; bool errorOccurred; bool demo; SlyceAuthorizer.LockTypes lockType; SlyceAuthorizer.LicenseStates status; bool licensed = Licensing.SlyceAuthorizer.IsLicensed("Visual NHibernate License.SlyceLicense", out message, out daysRemaining, out errorOccurred, out demo, out lockType, out status); bool mustClose = false; if (licensed) { ShowMessageBox("License installed.", "License Installed", MessageBoxButtons.OK, MessageBoxIcon.Information); mustClose = true; } else if (demo && daysRemaining >= 0) { ShowMessageBox(string.Format("{0} days remaining.", daysRemaining), "Trial Installed", MessageBoxButtons.OK, MessageBoxIcon.Warning); mustClose = true; } else { ShowMessageBox("Your trial has expired.", "Trial Expired", MessageBoxButtons.OK, MessageBoxIcon.Warning); mustClose = false; } //MessageBox.Show("ArchAngel has been successfully activated!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); ParentForm.Cursor = Cursors.Default; HasNext = false; HasFinish = true; if (mustClose) { frmLicenseWizard.Result = ScreenStart.Actions.Activate; frmLicenseWizard.CloseWizard(); } return; } MessageBox.Show("Can't unlock.\n" + message, "Activation Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }