Ejemplo n.º 1
0
        void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_modified)
            {
                DialogResult res = MessageDisplay.QueryWithCancel(Translator.Translate("TXT_SAVE_BEFORE_EXIT"),
                                                                  Translator.Translate("TXT_APPLY_CFG"), MessageBoxIcon.Question);

                if (res == DialogResult.Yes)
                {
                    _config.WriteXml(_cfgPath);
                }
                else if (res == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }
        }
        void AddonPanel_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = false;
            if (_themeFile == null || _themeFile.IsModified == false)
            {
                return;
            }

            DialogResult dlgRes = MessageDisplay.QueryWithCancel(
                "The theme file has been modified.\nDo you want to save the changes before exiting ?",
                "Confirm saving");

            switch (dlgRes)
            {
            case DialogResult.Yes:
            {
                if (_themeFile.IsSaved)
                {
                    e.Cancel = SaveThemeFileNoDialog() == false;
                }
                else
                {
                    // New theme, never saved before.
                    e.Cancel = SaveThemeFileWithDialog() == false;
                }
            }
            break;

            case DialogResult.No:
                e.Cancel = false;
                break;

            case DialogResult.Cancel:
                e.Cancel = true;
                break;
            }
        }