Пример #1
0
        private void ProcessRemoveControl(WorkItem workItem, Control control)
        {
            #region MdiTabWorkspace
            if (control is Form)
            {
                UltraMdiTabWorkspace mdiManager = MdiParentManager.GetTabbedMdiManager((Form)control) as UltraMdiTabWorkspace;

                if (mdiManager != null)
                {
                    this.RemoveItem(workItem, mdiManager);
                }
            }
            #endregion             //MdiTabWorkspace

            #region ToolbarsManagerWorkspace

            UltraToolbarsManagerWorkspace toolbarMgr = UltraToolbarsManager.FromContainer(control) as UltraToolbarsManagerWorkspace;

            if (toolbarMgr != null)
            {
                this.RemoveItem(workItem, toolbarMgr);
            }

            #endregion             //ToolbarsManagerWorkspace

            #region UltraDockWorkspace
            if (control is AutoHideControl)
            {
                // if there is an mdi tab workspace, register it using its name
                UltraDockWorkspace dockManager = ((AutoHideControl)control).Owner as UltraDockWorkspace;

                if (dockManager != null)
                {
                    this.RemoveItem(workItem, dockManager);

                    foreach (DockableControlPane pane in dockManager.ControlPanes)
                    {
                        if (null != pane.Control)
                        {
                            this.RemoveItem(workItem, pane.Control);
                        }
                    }
                }
            }
            #endregion             //UltraDockWorkspace
        }
Пример #2
0
        private void ProcessAddControl(WorkItem workItem, Control control)
        {
            // replace any place holders
            if (control is ISmartPartPlaceholder)
            {
                this.ReplacePlaceHolder(workItem, control as ISmartPartPlaceholder);
            }

            #region MdiTabWorkspace
            if (control is Form)
            {
                // if there is an mdi tab workspace, register it using its name
                UltraMdiTabWorkspace mdiManager = MdiParentManager.GetTabbedMdiManager((Form)control) as UltraMdiTabWorkspace;

                if (mdiManager != null)
                {
                    this.AddItem(workItem, mdiManager, mdiManager.WorkspaceName);
                }
            }
            #endregion             //MdiTabWorkspace

            #region ToolbarsManagerWorkspace
            UltraToolbarsManagerWorkspace toolbarMgr = UltraToolbarsManager.FromContainer(control) as UltraToolbarsManagerWorkspace;

            if (toolbarMgr != null)
            {
                // be sure to add it as workspace if it is one
                this.AddItem(workItem, toolbarMgr, toolbarMgr.WorkspaceName);
            }
            #endregion             //ToolbarsManagerWorkspace

            #region UltraDockWorkspace
            if (control is AutoHideControl)
            {
                // if there is an mdi tab workspace, register it using its name
                UltraDockWorkspace dockManager = ((AutoHideControl)control).Owner as UltraDockWorkspace;

                if (dockManager != null)
                {
                    this.AddItem(workItem, dockManager, dockManager.WorkspaceName);

                    foreach (DockableControlPane pane in dockManager.ControlPanes)
                    {
                        if (null != pane.Control)
                        {
                            this.ProcessAddControl(workItem, pane.Control);
                        }
                    }
                }
            }
            #endregion             //UltraDockWorkspace

            // account for other info - placeholder, smart part, etc.
            if (this.AddItem(workItem, control, control.Name) == false)
            {
                // iterate the children
                foreach (Control child in control.Controls)
                {
                    ProcessAddControl(workItem, child);
                }
            }
        }