private void OnNavigationStopped(PageStackEntry entry, NavigationMode mode) { NavigationStopped?.Invoke(this, new NavigationEventArgs( entry.Instance, mode, entry.NavigationTransitionInfo, entry.Parameter, entry.SourcePageType, null )); }
private bool InnerNavigate(PageStackEntry entry, NavigationMode mode) { try { // Navigating var navigatingFromArgs = new NavigatingCancelEventArgs( mode, entry.NavigationTransitionInfo, entry.Parameter, entry.SourcePageType ); Navigating?.Invoke(this, navigatingFromArgs); CurrentEntry?.Instance.OnNavigatingFrom(navigatingFromArgs); if (navigatingFromArgs.Cancel) { NavigationStopped?.Invoke(this, new NavigationEventArgs( entry.Instance, mode, entry.NavigationTransitionInfo, entry.Parameter, entry.SourcePageType, null )); return(false); } // Navigate var previousEntry = CurrentEntry; CurrentEntry = entry; if (mode == NavigationMode.New) { // Doing this first allows CurrentEntry to reuse existing page if pooling is enabled ReleasePages(ForwardStack); } if (CurrentEntry.Instance == null) { var page = CreatePageInstanceCached(entry.SourcePageType); if (page == null) { return(false); } page.Frame = this; CurrentEntry.Instance = page; } Content = CurrentEntry.Instance; switch (mode) { case NavigationMode.New: ForwardStack.Clear(); if (previousEntry != null) { BackStack.Add(previousEntry); } break; case NavigationMode.Back: ForwardStack.Add(previousEntry); BackStack.Remove(CurrentEntry); break; case NavigationMode.Forward: BackStack.Add(previousEntry); ForwardStack.Remove(CurrentEntry); break; case NavigationMode.Refresh: break; } // Navigated var navigationEvent = new NavigationEventArgs( CurrentEntry.Instance, mode, entry.NavigationTransitionInfo, entry.Parameter, entry.SourcePageType, null ); previousEntry?.Instance.OnNavigatedFrom(navigationEvent); CurrentEntry.Instance.OnNavigatedTo(navigationEvent); Navigated?.Invoke(this, navigationEvent); VisualTreeHelper.CloseAllPopups(); return(true); } catch (Exception exception) { NavigationFailed?.Invoke(this, new NavigationFailedEventArgs(entry.SourcePageType, exception)); return(false); } }
void PART_Frame_NavigationStopped(object sender, NavigationEventArgs e) { NavigationStopped?.Invoke(this, e); }