Ejemplo n.º 1
0
        static private void CreatePanels(DockingManagerControl manager, DockingManagerControlData dockingManagerControlData)
        {
            Dictionary <DockingType, int> mapDockingTypeToCount = new Dictionary <DockingType, int>();

            foreach (DockingControlData data in dockingManagerControlData.DockingControls)
            {
                if (data.DockingType != DockingType.Floating)
                {
                    if (mapDockingTypeToCount.ContainsKey(data.DockingType))
                    {
                        mapDockingTypeToCount[data.DockingType] =
                            Math.Max(mapDockingTypeToCount[data.DockingType], data.PanelIndex);
                    }
                    else
                    {
                        mapDockingTypeToCount.Add(data.DockingType, data.PanelIndex);
                    }
                }
            }

            foreach (DockingType dockingType in mapDockingTypeToCount.Keys)
            {
                int panels = mapDockingTypeToCount[dockingType];

                for (int index = 0; index <= panels; index += 1)
                {
                    IDockingPanelCollection panel = manager.Panels[dockingType];

                    if (panel.Count < (index + 1))
                    {
                        panel.InsertPanel(index);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        static private bool HasVisibleContainer(IDockingPanelCollection panels)
        {
            foreach (DockControlContainer control in panels)
            {
                if (control.Visible)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        private DockingContainerControlData[] CreateDockingControlData(IDockingPanelCollection panelCollection)
        {
            DockingContainerControlData[] data = new DockingContainerControlData[panelCollection.Count];

            int index = 0;

            foreach (IDockingPanel panel in panelCollection)
            {
                data[index++] = new DockingContainerControlData(panel);
            }

            return(data);
        }
Ejemplo n.º 4
0
        static private void DeseriailizeDockingControlData(IDockingPanelCollection panels, DockingContainerControlData[] data)
        {
            int index = 0;

            while (panels.Count < data.Length)
            {
                panels.InsertPanel(panels.Count);
            }

            for (; index < data.Length; index += 1)
            {
                data[index].Deserialize(panels[index]);
            }
        }
Ejemplo n.º 5
0
        static private void ClearEmptyPanels(IDockingPanelCollection collection)
        {
            DockControlContainerCollection panels = collection as DockControlContainerCollection;

            for (int index = 0; panels.Count > 1 && index < panels.Count; index += 1)
            {
                DockControlContainer container = panels[index] as DockControlContainer;

                if (container.DockedControlList.Count == 0)
                {
                    panels.Remove(container);
                    index -= 1;
                }
                else if (container.DockedControlList.GetVisibleDockedControlCount() == 0)
                {
                    container.Visible = true;
                    container.Visible = false;
                }
            }
        }