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(); } }
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(); } }
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; } } }