Beispiel #1
0
        /// <summary>
        /// Clears the windows manager
        /// </summary>
        public void Clear()
        {
            Action <Panel> clearAction = panel => panel.Children.Clear();

            clearAction(TopPinnedWindows);
            clearAction(TopWindowHeaders);
            clearAction(BottomPinnedWindows);
            clearAction(BottomWindowHeaders);
            clearAction(LeftPinnedWindows);
            clearAction(LeftWindowHeaders);
            clearAction(RightPinnedWindows);
            clearAction(RightWindowHeaders);
            clearAction(FloatingPanel);
            clearAction(PopupArea);
            DocumentContainer.Content = null;
            DocumentContainer.Clear();
            _dockPaneStateMonitorList.Clear();
            _popupTimer.Stop();
        }
Beispiel #2
0
        /// <summary>
        /// Merges the empty document containers
        /// </summary>
        /// <returns>New content that should be child of parent DocumentContainer</returns>
        private object MergeEmptyDocumentContainers()
        {
            object newChild = null;

            switch (State)
            {
            case DocumentContainerState.ContainsDocuments:

                if (Documents.Count == 0)
                {
                    State = DocumentContainerState.Empty;
                }
                else
                {
                    newChild = this;
                }

                break;

            case DocumentContainerState.SplitHorizontally:
            case DocumentContainerState.SplitVertically:

                Grid contentGrid = Content as Grid;

                if (contentGrid != null)
                {
                    DocumentContainer firstChild = contentGrid.Children[1] as DocumentContainer;
                    Cuisine.Utilities.Validate.NotNull(firstChild, "firstChild");

                    DocumentContainer secondChild = contentGrid.Children[2] as DocumentContainer;
                    Cuisine.Utilities.Validate.NotNull(secondChild, "secondChild");

                    object firstReduceResult  = ReduceChild(firstChild);
                    object secondReduceResult = ReduceChild(secondChild);

                    if ((firstReduceResult != null) && (secondReduceResult != null))
                    {
                        newChild = this;
                    }
                    else if ((firstReduceResult == null) && (secondReduceResult == null))
                    {
                        Content = null;
                        State   = DocumentContainerState.Empty;
                    }
                    else if (firstReduceResult != null)
                    {
                        secondChild.Clear();
                        newChild = this;
                    }
                    else     /*if (secondReduceResult != null)*/
                    {
                        firstChild.Clear();
                        newChild = this;
                    }
                }

                break;
            }

            return(newChild);
        }