Пример #1
0
        /// <summary>
        /// If there are any unsaved changes, asks the user if they want to save. Also gives the user the option to cancel the calling action.
        /// </summary>
        /// <returns>True if the action should proceed, false otherwise.</returns>
        bool CheckForUnsaved()
        {
            if (!ProfileLoaded || !unsavedChanges) return true;

            DlgClose close = new DlgClose(GlobalStrings.MainForm_UnsavedChangesWillBeLost, GlobalStrings.MainForm_UnsavedChanges, SystemIcons.Warning.ToBitmap(), true, currentProfile.AutoExport);

            DialogResult res = close.ShowDialog();

            //DialogResult res = MessageBox.Show( GlobalStrings.MainForm_UnsavedChangesWillBeLost, GlobalStrings.MainForm_UnsavedChanges, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning );
            if (res == System.Windows.Forms.DialogResult.No)
            {
                return true;
            }
            if (res == System.Windows.Forms.DialogResult.Cancel)
            {
                return false;
            }
            currentProfile.AutoExport = close.Export;
            return SaveProfile(null);
        }
Пример #2
0
 private void menu_File_SaveProfile_Click(object sender, EventArgs e)
 {
     ClearStatus();
     DlgClose close = new DlgClose(GlobalStrings.MainForm_SaveProfileConfirm, GlobalStrings.MainForm_SaveProfile, SystemIcons.Question.ToBitmap(), false, currentProfile.AutoExport);
     DialogResult res = close.ShowDialog();
     if (res == DialogResult.Yes)
     {
         currentProfile.AutoExport = close.Export;
         SaveProfile(null);
     }
     FlushStatus();
 }