public bool CloseWindow(bool force, bool fromMenu, int pageNum) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; OnClosing(args); if (args.Cancel) { return(false); } if (fromMenu == true) { workbench.RemoveTab(tabControl.PageNum(this)); } else { workbench.RemoveTab(pageNum); } OnClosed(args); content.ContentNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= new EventHandler(SetTitleEvent); content.BeforeSave -= new EventHandler(BeforeSave); content.ContentChanged -= new EventHandler(OnContentChanged); content.WorkbenchWindow = null; if (subViewContents != null) { foreach (IAttachableViewContent sv in subViewContents) { subViewNotebook.Remove(sv.Control); sv.Dispose(); } this.subViewContents = null; subViewNotebook.Remove(content.Control); } DetachFromPathedDocument(); content.Dispose(); box.Destroy(); this.subViewToolbar = null; this.separatorItem = null; this.content = null; this.subViewNotebook = null; this.tabControl = null; tabLabel.Destroy(); this.tabLabel = null; this.tabPage = null; Destroy(); return(true); }
public bool CloseWindow(bool force, bool animate) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; OnClosing(args); if (args.Cancel) { return(false); } workbench.RemoveTab(tab.Index, animate); OnClosed(args); foreach (IAttachableViewContent sv in SubViewContents) { sv.Dispose(); } content.ContentNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= HandleDirtyChanged; content.BeforeSave -= new EventHandler(BeforeSave); content.ContentChanged -= new EventHandler(OnContentChanged); content.WorkbenchWindow = null; content.Dispose(); DetachFromPathedDocument(); Destroy(); return(true); }
public async Task <bool> CloseWindow(bool force, bool animate) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; await OnClosing(args); if (args.Cancel) { return(false); } workbench.RemoveTab(tabControl, tab.Index, animate); OnClosed(args); // This may happen if the document contains an attached view that is shown by // default. In that case the main view is not added to the notebook and won't // be destroyed. bool destroyMainPage = tabPage != null && tabPage.Parent == null; Destroy(); // Destroy after the document is destroyed, since attached views may have references to the main view if (destroyMainPage) { tabPage.Destroy(); } return(true); }
public bool CloseWindow(bool force, bool fromMenu, int pageNum) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; OnClosing(args); if (args.Cancel) { return(false); } if (fromMenu == true) { workbench.RemoveTab(tabControl.PageNum(this)); } else { workbench.RemoveTab(pageNum); } OnClosed(args); if (subViewContents != null) { foreach (IAttachableViewContent sv in subViewContents) { sv.Dispose(); } } content.ContentNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= new EventHandler(SetTitleEvent); content.BeforeSave -= new EventHandler(BeforeSave); content.ContentChanged -= new EventHandler(OnContentChanged); content.WorkbenchWindow = null; IdeApp.Workbench.ActiveDocumentChanged -= ActiveDocumentChanged; content.Dispose(); DetachFromPathedDocument(); Destroy(); return(true); }
public bool CloseWindow(bool force, bool animate) { bool wasActive = workbench.ActiveWorkbenchWindow == this; WorkbenchWindowEventArgs args = new WorkbenchWindowEventArgs(force, wasActive); args.Cancel = false; OnClosing(args); if (args.Cancel) { return(false); } workbench.RemoveTab(tabControl, tab.Index, animate); OnClosed(args); Destroy(); return(true); }