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