/// <summary> /// Does actual navigation - adds journal entry if necessary, etc. /// </summary> /// <param name="e">Details of the navigation event.</param> private void DoNavigation(ViewManagerNavigatedEventArgs e) { DateTime newTimeOfNavigation = DateTime.UtcNow; TimeSpan timeSinceLastNavigation = newTimeOfNavigation - _lastNavigation; if (_contentStateToSave != null && this.IsNewNavigation(e.NavigationMode)) { NavigationService navigationService = NavigationService.GetNavigationService(this); if (navigationService != null) { CustomContentState contentStateToSave = _contentStateToSave; _contentStateToSave = null; if (timeSinceLastNavigation > TimeSpan.FromSeconds(3) || !e.NewNavigator.ShouldReplaceNavigatorInJournal(e.OldNavigator)) { navigationService.AddBackEntry(contentStateToSave); } } } if (e.ContentStateToSave != null) { _contentStateToSave = e.ContentStateToSave; } Content = e.Content; _lastNavigation = newTimeOfNavigation; }
/// <summary> /// Event handler for ViewManager's navigated event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Details of the navigation.</param> private void OnViewManagerNavigated(object sender, ViewManagerNavigatedEventArgs e) { this.DoNavigation(e); }