/// <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); } } } }
public ViewManager(FacebookService facebookService, string[] parameters) { Verify.IsNotNull(facebookService, "facebookService"); ProcessCommandLineArgs(parameters); NavigationCommands = new NavigationCommands(this); ActionCommands = new ActionCommands(this); // _startPage may get set by processCommandLineArgs MasterNavigator = new MasterNavigator(this, facebookService, _startPage); FacebookAppId = facebookService.ApplicationId; facebookService.PropertyChanged += facebookService_PropertyChanged; Assert.IsNotNull(facebookService.MeContact); facebookService.MeContact.PropertyChanged += _OnMeContactPropertyChanged; }
/// <summary> /// Populates items for the NavPanel, excluding ReadingList which is included by default /// </summary> /// <returns></returns> protected override NavigationItemCollection GetValidNavigationItems() { List <NavigationItem> navigationItems = new List <NavigationItem>(); // Get Navigators from MasterNavigator and create navigation item list ReadOnlyCollection <Navigator> navigators = MasterNavigator.GetTopLevelNavigators(); foreach (Navigator navigator in navigators) { string name = String.Empty; if (navigator is ItemNavigator && !(navigator is ReadingListNavigator)) { Item item = (navigator as ItemNavigator).Content as Item; if (item != null) { name = item.Title; NavigationItem navigationItem = new NavigationItem(name, navigator); navigationItems.Add(navigationItem); } } } return(new NavigationItemCollection(navigationItems)); }