Example #1
0
        internal void RemovePane(DockPane pane)
        {
            if (!Panes.Contains(pane))
            {
                return;
            }

            Panes.Remove(pane);
        }
Example #2
0
        /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="SetPaneIndex(DockPane, int)"]/*'/>
        public void SetPaneIndex(DockPane pane, int index)
        {
            int oldIndex = Panes.IndexOf(pane);

            if (oldIndex == -1)
            {
                throw(new ArgumentException(ResourceHelper.GetString("DockPanel.SetPaneIndex.InvalidPane")));
            }

            if (index < 0 || index > Panes.Count - 1)
            {
                if (index != -1)
                {
                    throw(new ArgumentOutOfRangeException(ResourceHelper.GetString("DockPanel.SetPaneIndex.InvalidIndex")));
                }
            }

            if (oldIndex == index)
            {
                return;
            }
            if (oldIndex == Panes.Count - 1 && index == -1)
            {
                return;
            }

            Panes.Remove(pane);
            if (index == -1)
            {
                Panes.Add(pane);
            }
            else if (oldIndex < index)
            {
                Panes.AddAt(pane, index - 1);
            }
            else
            {
                Panes.AddAt(pane, index);
            }

            if (pane.DockState == DockState.Float)
            {
                pane.FloatWindow.PerformLayout();
            }
            else if (DockHelper.IsDockWindowState(pane.DockState))
            {
                DockWindows[pane.DockState].PerformLayout();
            }
            else if (DockHelper.IsDockStateAutoHide(pane.DockState))
            {
                Refresh();
            }
        }
        public void SetPaneIndex(DockPane pane, int index)
        {
            int oldIndex = Panes.IndexOf(pane);

            if (oldIndex == -1)
            {
                throw(new ArgumentException(Strings.DockPanel_SetPaneIndex_InvalidPane));
            }

            if (index < 0 || index > Panes.Count - 1)
            {
                if (index != -1)
                {
                    throw(new ArgumentOutOfRangeException(Strings.DockPanel_SetPaneIndex_InvalidIndex));
                }
            }

            if (oldIndex == index)
            {
                return;
            }
            if (oldIndex == Panes.Count - 1 && index == -1)
            {
                return;
            }

            Panes.Remove(pane);
            if (index == -1)
            {
                Panes.Add(pane);
            }
            else if (oldIndex < index)
            {
                Panes.AddAt(pane, index - 1);
            }
            else
            {
                Panes.AddAt(pane, index);
            }
        }
        private void Pane_Unloaded(object sender, RoutedEventArgs e)
        {
            var pane = sender as RadPane;

            if (!(pane.Tag is DockingPane tag) || !pane.IsHidden)
            {
                return;
            }

            if (tag.DisposeWhenClosed)
            {
                Panes.Remove(pane);
            }

            System.Threading.ThreadPool.QueueUserWorkItem(cb => {
                System.Threading.Thread.Sleep(1000);
                for (int i = 0; i < 2; i++)
                {
                    System.GC.Collect();
                }
            });
        }