Esempio n. 1
0
        private void LispEditor_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Check if the document has been modified
            if (this.Scintilla.Modified)
            {
                string message = String.Format(
                    CultureInfo.CurrentCulture,
                    "The text in {0} has changed.{1}{2}Do you want to save the changes?",
                    this.Text.TrimEnd(' ', '*'),
                    Environment.NewLine,
                    Environment.NewLine);

                DialogResult dr = MessageBox.Show(this, message, Program.Title, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
                if (dr == DialogResult.Cancel)
                {
                    // Cancel closing
                    e.Cancel = true;
                    return;
                }
                else if (dr == DialogResult.Yes)
                {
                    // Try to save
                    e.Cancel = !FileCommands.SaveFile(this, this);
                    return;
                }
            }

            // Continue closing
        }
Esempio n. 2
0
 private void SaveFile(LispEditor editor)
 {
     FileCommands.SaveFile(this, editor);
 }
Esempio n. 3
0
 private void saveContextMenuItem_Click(object sender, EventArgs e)
 {
     FileCommands.SaveFile(this.parent, this.parent);
 }