Beispiel #1
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     foreach (Editor tab in tablist.ToArray())
     {
         EditorClosingEventArgs args = new EditorClosingEventArgs(tab);
         Editor_TabClosing(args);
         if (args.Cancel)
         {
             e.Cancel = true;
             return;
         }
         tablist.Remove(tab);
         tab.Close();
     }
 }
Beispiel #2
0
 public void CloseTab(Editor tab)
 {
     if (CurrentTB != null)
     {
         EditorClosingEventArgs args = new EditorClosingEventArgs(tab);
         Editor_TabClosing(args);
         if (args.Cancel)
         {
             return;
         }
         tablist.Remove(tab);
         dockpanel.Controls.Remove(tab);
         UpdateDocumentMap();
     }
 }
Beispiel #3
0
        private void Editor_TabClosing(EditorClosingEventArgs e)
        {
            if (e.Item.mainEditor.IsChanged)
            {
                switch (MessageBox.Show("Do you want save " + e.Item.Title + " ?", "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information))
                {
                case DialogResult.Yes:
                    if (!CallSave(e.Item))
                    {
                        e.Cancel = true;
                    }
                    break;

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