Exemplo n.º 1
0
        private void InternalAddToDockList(INestedPanesContainer container, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if ((container.DockState == DockState.Float) != IsFloat)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_InvalidContainer);
            }

            int count = container.NestedPanes.Count;

            if (container.NestedPanes.Contains(this))
            {
                count--;
            }
            if (prevPane == null && count > 0)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_NullPrevPane);
            }

            if (prevPane != null && !container.NestedPanes.Contains(prevPane))
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_NoPrevPane);
            }

            if (prevPane == this)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_SelfPrevPane);
            }

            INestedPanesContainer oldContainer = NestedPanesContainer;
            DockState             oldDockState = DockState;

            container.NestedPanes.Add(this);
            NestedDockingStatus.SetStatus(container.NestedPanes, prevPane, alignment, proportion);

            if (DockHelper.IsDockWindowState(DockState))
            {
                m_dockState = container.DockState;
            }

            RefreshStateChange(oldContainer, oldDockState);
        }