public IWorkbenchWindow ShowView(IViewContent content) { if (content.WorkbenchWindow is SdiWorkspaceWindow) { SdiWorkspaceWindow oldSdiWindow = (SdiWorkspaceWindow)content.WorkbenchWindow; if (!oldSdiWindow.IsDisposed) { oldSdiWindow.Show(dockPanel); return(oldSdiWindow); } } if (!content.Control.Visible) { content.Control.Visible = true; } content.Control.Dock = DockStyle.Fill; SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(content); sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent); if (dockPanel != null) { sdiWorkspaceWindow.Show(dockPanel); } return(sdiWorkspaceWindow); }
void AddWindowToDockPanelWithoutSwitching(SdiWorkspaceWindow sdiWorkspaceWindow) { sdiWorkspaceWindow.DockPanel = dockPanel; SdiWorkspaceWindow otherWindow = dockPanel.ActiveContent as SdiWorkspaceWindow; if (otherWindow == null) { otherWindow = dockPanel.Contents.OfType <SdiWorkspaceWindow>().FirstOrDefault(c => c.Pane != null); } if (otherWindow != null) { sdiWorkspaceWindow.Pane = otherWindow.Pane; } sdiWorkspaceWindow.DockState = DockState.Document; }
void CloseWindowEvent(object sender, EventArgs e) { SdiWorkspaceWindow f = (SdiWorkspaceWindow)sender; f.CloseEvent -= CloseWindowEvent; foreach (IViewContent vc in f.ViewContents.ToArray()) { ((IWorkbench)wbForm).CloseContent(vc); } if (f == oldSelectedWindow) { oldSelectedWindow = null; } ActiveMdiChanged(this, null); }
public void CloseWindowEvent(object sender, EventArgs e) { SdiWorkspaceWindow f = (SdiWorkspaceWindow)sender; f.CloseEvent -= CloseWindowEvent; if (f.ViewContent != null) { ((IWorkbench)wbForm).CloseContent(f.ViewContent); if (f == oldSelectedWindow) { oldSelectedWindow = null; } ActiveMdiChanged(this, null); } }
void DetachViewContents(bool dispose) { foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) { try { SdiWorkspaceWindow f = (SdiWorkspaceWindow)viewContent.WorkbenchWindow; f.DockPanel = null; if (dispose) { viewContent.WorkbenchWindow = null; f.CloseEvent -= new EventHandler(CloseWindowEvent); f.DetachContent(); f.Dispose(); } } catch (Exception e) { MessageService.ShowError(e); } } }
public IWorkbenchWindow ShowView(IViewContent content, bool switchToOpenedView) { if (content.WorkbenchWindow is SdiWorkspaceWindow) { SdiWorkspaceWindow oldSdiWindow = (SdiWorkspaceWindow)content.WorkbenchWindow; if (!oldSdiWindow.IsDisposed) { if (switchToOpenedView) { oldSdiWindow.Show(dockPanel); } else { this.AddWindowToDockPanelWithoutSwitching(oldSdiWindow); } return(oldSdiWindow); } } content.Control.Dock = DockStyle.Fill; SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(); sdiWorkspaceWindow.ViewContents.Add(content); sdiWorkspaceWindow.ViewContents.AddRange(content.SecondaryViewContents); sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent); if (dockPanel != null) { if (switchToOpenedView) { sdiWorkspaceWindow.Show(dockPanel); } else { this.AddWindowToDockPanelWithoutSwitching(sdiWorkspaceWindow); } } return(sdiWorkspaceWindow); }
internal ViewContentCollection(SdiWorkspaceWindow window) { this.window = window; }
public IWorkbenchWindow ShowView(IViewContent content) { if (content.WorkbenchWindow is SdiWorkspaceWindow) { SdiWorkspaceWindow oldSdiWindow = (SdiWorkspaceWindow)content.WorkbenchWindow; if (!oldSdiWindow.IsDisposed) { oldSdiWindow.Show(dockPanel); return oldSdiWindow; } } if (!content.Control.Visible) { content.Control.Visible = true; } content.Control.Dock = DockStyle.Fill; SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(content); sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent); if (dockPanel != null) { sdiWorkspaceWindow.Show(dockPanel); } return sdiWorkspaceWindow; }
void AddWindowToDockPanelWithoutSwitching(SdiWorkspaceWindow sdiWorkspaceWindow) { sdiWorkspaceWindow.DockPanel = dockPanel; SdiWorkspaceWindow otherWindow = dockPanel.ActiveContent as SdiWorkspaceWindow; if (otherWindow == null) { otherWindow = dockPanel.Contents.OfType<SdiWorkspaceWindow>().FirstOrDefault(c => c.Pane != null); } if (otherWindow != null) { sdiWorkspaceWindow.Pane = otherWindow.Pane; } sdiWorkspaceWindow.DockState = DockState.Document; }
public IWorkbenchWindow ShowView(IViewContent content, bool switchToOpenedView) { if (content.WorkbenchWindow is SdiWorkspaceWindow) { SdiWorkspaceWindow oldSdiWindow = (SdiWorkspaceWindow)content.WorkbenchWindow; if (!oldSdiWindow.IsDisposed) { if (switchToOpenedView) { oldSdiWindow.Show(dockPanel); } else { this.AddWindowToDockPanelWithoutSwitching(oldSdiWindow); } return oldSdiWindow; } } content.Control.Dock = DockStyle.Fill; SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(); sdiWorkspaceWindow.ViewContents.Add(content); sdiWorkspaceWindow.ViewContents.AddRange(content.SecondaryViewContents); sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent); if (dockPanel != null) { if (switchToOpenedView) { sdiWorkspaceWindow.Show(dockPanel); } else { this.AddWindowToDockPanelWithoutSwitching(sdiWorkspaceWindow); } } return sdiWorkspaceWindow; }