public void OpenContent(ContentFrame frame, ContentFrame relframe, DocumentDockPosition position) { frame.m_parentFrame = this; DockPane pane = null; if (dockPanel1.ActiveDocument != null) { pane = dockPanel1.ActiveDocument.DockHandler.Pane; } if (relframe != null) { var cw = GetDockContent(relframe); if (cw != null) { pane = cw.DockHandler.Pane; } } if (frame == PrimaryContent) { frame.PersistString = "primary"; } ContentWrapper docker = new ContentWrapper(frame, frame.PersistString); if (frame == PrimaryContent) { docker.DockHandler.CloseButtonVisible = false; } if (pane != null) { switch (position) { case DocumentDockPosition.Left: docker.Show(pane, DockAlignment.Left, 0.5); return; case DocumentDockPosition.Right: docker.Show(pane, DockAlignment.Right, 0.5); return; case DocumentDockPosition.Top: docker.Show(pane, DockAlignment.Top, 0.5); return; case DocumentDockPosition.Bottom: docker.Show(pane, DockAlignment.Bottom, 0.5); return; } } // fallback docker.Show(dockPanel1); }
private IDockContent GetContentFromPersistString(string persistString) { foreach (var item in m_widgets) { if (item.PersistString == persistString) { var cnt = new ContentWrapper(item.Frame, item.PersistString); //cnt.ClosedEvent += docker_ClosedEvent; cnt.FormClosed += docker_ClosedEvent; return(cnt); } } return(null); }
internal IDockContent GetContentFromPersistString(string persistString) { var frame = frames.Get(persistString, null); if (frame != null) { frame.m_parentFrame = dockframe; ContentWrapper docker = new ContentWrapper(frame, frame.PersistString); if (frame == dockframe.PrimaryContent) { docker.DockHandler.CloseButtonVisible = false; } return(docker); } return(null); }
public void AddWidget(IWidget widget, WeifenLuo.WinFormsUI.Docking.DockState dockstate, string persistString) { var ctrl = widget.GetControl(); widget.IsDesigning = EnabledDesign; ctrl.ConnPack = ConnPack; string ps = persistString ?? Guid.NewGuid().ToString(); var docker = new ContentWrapper(ctrl, ps); docker.Show(dockPanel1, dockstate); //docker.ClosedEvent += new EventHandler(docker_ClosedEvent); docker.FormClosed += docker_ClosedEvent; m_widgets.Add(new Item { Frame = ctrl, Widget = widget, PersistString = ps }); if (m_appobj != null) { widget.LoadWidgetData(m_appobj); } OnChangedWidgetSet(); }