/// <summary> /// Determines whether document state is compatible with current dockpoint /// </summary> /// <param name="documentContainerState">State of the document container</param> /// <returns> /// <c>true</c> if document state is compatible with current dockpoint; otherwise, <c>false</c>. /// </returns> private bool IsDocumentStateCompatible(DocumentContainerState documentContainerState) { switch (documentContainerState) { case DocumentContainerState.Empty: return(true); break; case DocumentContainerState.ContainsDocuments: return(DockPoint == ContentDockPoint.Content); break; case DocumentContainerState.SplitHorizontally: return((DockPoint == ContentDockPoint.Left) || (DockPoint == ContentDockPoint.Right)); break; case DocumentContainerState.SplitVertically: return((DockPoint == ContentDockPoint.Top) || (DockPoint == ContentDockPoint.Bottom)); break; default: break; } return(false); }
/// <summary> /// Navigates the document container /// </summary> /// <param name="documentContainer">The document container.</param> private void NavigateDocumentContainer(DocumentContainer documentContainer) { DocumentContainerState state = InitializeDocumentContainer(documentContainer); switch (state) { case DocumentContainerState.Empty: // Do Nothing break; case DocumentContainerState.ContainsDocuments: ReadDocuments(documentContainer); break; case DocumentContainerState.SplitHorizontally: NavigateDocumentGrid(documentContainer, true); break; case DocumentContainerState.SplitVertically: NavigateDocumentGrid(documentContainer, false); break; default: throw new ArgumentOutOfRangeException(); } FinalizeDocumentContainer(); }
/// <summary> /// Called when parent state has changed /// </summary> /// <param name="state">The state.</param> private void OnParentStateChanged(DocumentContainerState state) { if (IsDocumentStateCompatible(state)) { AssociatedObject.Visibility = Visibility.Visible; } else { AssociatedObject.Visibility = Visibility.Hidden; } }