/// <summary>Form closing implementation</summary> /// <param name="sender">object</param> /// <param name="e">FormClosingEventArgs</param> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { //If the document is not saved then prompt the user to save if (m_IsContentModified && ( m_Features.CheckStatus(LicenseFeatures.Save.ToString()) || m_Features.CheckStatus(LicenseFeatures.SaveAs.ToString()))) { switch (MessageBox.Show(this, "The document is not saved. Do you wish to save now ?", "Simple Text Editor Self Signed Trial", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation)) { case DialogResult.Yes: if (!SaveFile()) { e.Cancel = true; } if (m_IsEvaluation && m_IsLicenseValid) { //we're shutting down, so just try to save what we can int ignore1, ignore2; m_EvaluationLicense.WriteAliases(out ignore1, out ignore2); m_EvaluationLicense.WriteLicenseFile(LicenseConfiguration.LicenseFilePath); } break; case DialogResult.No: break; case DialogResult.Cancel: e.Cancel = true; break; } } }
/// <summary>Close form button click event handler</summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (m_IsEvaluation && m_IsLicenseValid) { //we're shutting down, so just try to save what we can int ignore1, ignore2; m_EvaluationLicense.WriteAliases(out ignore1, out ignore2); m_EvaluationLicense.WriteLicenseFile(LicenseConfiguration.LicenseFilePath); } }