void editorTabControl_TabClosing(object sender, MySQL.Controls.TabClosingEventArgs e) { Logger.LogDebug("WQE.net", 1, "About to close tab: " + e.page.Text + "\n"); // Any docked app view (plugin)? if (e.page.Tag is AppViewDockContent) { e.canClose = (e.page.Tag as AppViewDockContent).CanCloseDocument(); } else { // One of the object editors. ITabDocument tabDocument = mainContentTabControl.ActiveDocument; if (tabDocument is IWorkbenchDocument) { e.canClose = (tabDocument as IWorkbenchDocument).CanCloseDocument(); } } Logger.LogDebug("WQE.net", 1, "Can close tab: " + e.canClose + "\n"); }
private void bottomTabControl_TabClosing(object sender, TabClosingEventArgs e) { ITabDocument document = (sender as FlatTabControl).DocumentFromPage(e.page); if (document is IWorkbenchDocument) e.canClose = (document as IWorkbenchDocument).CanCloseDocument(); else if (document is MySQL.Forms.AppViewDockContent) { MySQL.Forms.AppViewDockContent content = document as MySQL.Forms.AppViewDockContent; e.canClose = content.CanCloseDocument(); } }
/// <summary> /// Does the actual work to close a tab page, sending out appropriate events and updating /// internal structures. Returns true if the page was actually closed. /// </summary> public bool CloseTabPage(TabPage page) { if (page == null) return false; if (TabCount > 1 || CanCloseLastTab) { TabClosingEventArgs args = new TabClosingEventArgs(page, true, TabPages.IndexOf(page)); OnTabClosing(args); if (args.canClose) { // The page could be removed in the OnTabClosing event, so prepare for that. int tabIndex = TabPages.IndexOf(page); if (tabIndex > -1) { SetBusy(tabIndex, false); // Remove this tab and select its predecessor if possible. if (SelectedIndex > 0) SelectedIndex = SelectedIndex - 1; lastTabHit = -1; TabPages.Remove(page); } AdjustLayoutInfo(null); Update(); OnTabClosed(new TabClosedEventArgs(page)); // In the case OnTabClosed did not dispose of the page do it now. if (!page.IsDisposed) page.Dispose(); return true; } } return false; }
protected internal virtual void OnTabClosing(TabClosingEventArgs args) { if (TabClosing != null) TabClosing(this, args); }