/// <summary> /// Navigation may also take place through the journal when the application is hosted in a NavigationWindow, as is normal. /// On navigation through journal, the ViewContentState object gives the path of the navigation target. /// </summary> /// <remarks> /// When navigation takes place through the journal, the navigation mode reported by the navigaiton service is the platform's /// NavigationMode. It must be converted into ScePhoto's custom navigation mode type here. /// </remarks> /// <param name="path">The journal path to use.</param> /// <param name="mode">The journal navigation mode (NavigationMode.Back or .Forward).</param> private void _NavigateByJournal(string path, NavigationMode mode) { // Journal navigation must be back or forward if (mode == NavigationMode.Back || mode == NavigationMode.Forward) { NavigationMode readerNavigationMode = (mode == NavigationMode.Back) ? NavigationMode.Back : NavigationMode.Forward; if (!string.IsNullOrEmpty(path)) { Navigator currentNavigator = MasterNavigator.GetNavigatorFromPath(path); if (currentNavigator != null) { // Current navigator found, raise Navigating event object content = this._GetNavigatorContent(currentNavigator); CustomContentState customContent = null; if (currentNavigator.IncludeInJournal) { customContent = new _ViewContentState(currentNavigator); } var args = new ViewManagerNavigatedEventArgs(content, readerNavigationMode, customContent, this.CurrentNavigator, currentNavigator); CurrentNavigator = currentNavigator; _OnNavigated(args); } else { // Object is gone. Return error var error = new MissingItemError(path); var args = new ViewManagerNavigatedEventArgs(error, readerNavigationMode, null, this.CurrentNavigator, null); _OnNavigated(args); } } } }
/// <summary> /// Perform new navigation. /// </summary> /// <param name="navigator">Navigator which is the target of new navigation.</param> /// <param name="mode">Navigation mode, whether back, forward, etc.</param> private void _NavigateNew(Navigator navigator, NavigationMode mode) { if (navigator != null) { ViewManagerNavigatedEventArgs args = null; object content = _GetNavigatorContent(navigator); CustomContentState customContent = null; if (navigator.IncludeInJournal) { customContent = new _ViewContentState(navigator); } if (Object.ReferenceEquals(navigator, this.CurrentNavigator)) { // Navigating to the same content. Args should show Refresh mode since this should not be separate journal entry. // Ignore navigation mode passed in this case args = new ViewManagerNavigatedEventArgs(content, NavigationMode.Refresh, customContent, CurrentNavigator, navigator); } else { // Raise event indicating new navigation args = new ViewManagerNavigatedEventArgs(content, mode, customContent, CurrentNavigator, navigator); } CurrentNavigator = navigator; _OnNavigated(args); } }