Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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();
        }