private View NavigateToInternal(string navigationKey, object viewModel, bool isModal, bool isMessageBox) { var performAnimation = true; var navigationKeyInstance = NavigationKey.Parse(navigationKey); var parentViewInstanceKey = navigationKeyInstance.ParentViewInstanceKey; var viewInstanceKey = navigationKeyInstance.ViewInstanceKey; var viewKey = navigationKeyInstance.ViewKey; var hasParent = navigationKeyInstance.HasParent; var oldNode = _viewGroupCollectionManager.GetActiveNode(); ViewGroupNode newNode; // if the navigation key refers to a parent e.g : "parentView/view" if (hasParent) { if (_viewGroupCollectionManager.TryFindViewNode(viewInstanceKey, out newNode)) { // activates an existing node EnsuresViewHasParentAndMatch(newNode, parentViewInstanceKey); _viewGroupCollectionManager.ActivateExistingNode(newNode); // if the node already exists and the old and new nodes belong to the same group, do not animate performAnimation = oldNode.List != newNode.List; } else { // activates a new node EnsureParentViewExist(parentViewInstanceKey); EnsureParentViewIsTopMost(parentViewInstanceKey); newNode = CreateNewNodeFrom(viewInstanceKey, viewKey, viewModel, isModal, isMessageBox); var parentNode = _viewGroupCollectionManager.FindViewNode(parentViewInstanceKey); _viewGroupCollectionManager.ActivateNewNode(newNode, parentNode.List); } // perform asynchronous update of the UI if (performAnimation) { _taskInvoker.Enqueue( new Func <ViewGroupNode, ViewGroupNode, Task>(_workspaceAdapter.PerformUIActivation), oldNode, newNode); } return(newNode.Value); } // if the navigation key has a simple form e.g : "view" if (_viewGroupCollectionManager.TryFindViewNode(viewInstanceKey, out newNode)) { // activates an existing node newNode = _viewGroupCollectionManager.IsTopMostView(viewInstanceKey) ? newNode : newNode.List.Peek(); _viewGroupCollectionManager.ActivateExistingNode(newNode); // if the node already exists and the old and new nodes belong to the same group, do not animate performAnimation = oldNode.List != newNode.List; } else { // activates a new node newNode = CreateNewNodeFrom(viewInstanceKey, viewKey, viewModel, isModal, isMessageBox); _viewGroupCollectionManager.ActivateNewNode(newNode); } // perform asynchronous update of the UI if (performAnimation) { _taskInvoker.Enqueue( new Func <ViewGroupNode, ViewGroupNode, Task>(_workspaceAdapter.PerformUIActivation), oldNode, newNode); } return(newNode.Value); }