private async Task <bool> RaisePageOnNavigatingFromAsync(MtPageDescription currentPage, MtPageDescription nextPage, NavigationMode mode) { var page = currentPage.GetPage(this); var args = new MtNavigatingCancelEventArgs(); args.Content = page; args.SourcePageType = currentPage.Type; args.NavigationMode = mode; args.Parameter = currentPage.Parameter; await page.OnNavigatingFromCoreAsync(args); if (!args.Cancel && nextPage != null) { var args2 = new MtNavigatingCancelEventArgs(); args2.SourcePageType = nextPage.Type; args2.NavigationMode = mode; args2.Parameter = nextPage.Parameter; var copy = Navigating; if (copy != null) { copy(this, args2); args.Cancel = args2.Cancel; } } return(args.Cancel); }
internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e) { OnNavigatingFrom(e); var task = OnNavigatingFromAsync(e); if (task != null) { await task; } }
protected internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e) { #if DEBUG Debug.WriteLine("1. OnNavigatingFrom:" + GetType().FullName); #endif OnNavigatingFrom(e); var task = OnNavigatingFromAsync(e); if (task != null) { await task; } }
private async Task <bool> RaisePageOnNavigatingFromAsync(MtPageDescription description, NavigationMode mode) { var page = description.GetPage(this); var args = new MtNavigatingCancelEventArgs(); args.Content = page; args.SourcePageType = description.Type; args.NavigationMode = mode; IsNavigating = true; await page.OnNavigatingFromCoreAsync(args); IsNavigating = false; return(args.Cancel); }
private void RootFrame_Navigating(object sender, MtNavigatingCancelEventArgs e) { _lastPageContent = this.RootFrame.Content; var ui = _lastPageContent as FrameworkElement; if (ui == null) { return; } var vm = ui.DataContext as NavigationViewModelBase; if (vm == null) { return; } var args = new NavigatingFromEventArgs { Cancel = e.Cancel, NavigationMode = e.NavigationMode, Parameter = e.Parameter }; vm.OnNavigatingFrom(args); }
/// <summary>Called when navigating from this page. /// The navigation does no happen until the returned task has completed. /// Return null or empty task to run the method synchronously. </summary> /// <param name="args">The event arguments. </param> /// <returns>The task. </returns> protected override Task OnNavigatingFromAsync(MtNavigatingCancelEventArgs args) { if (args.NavigationMode == NavigationMode.Back) return Task.Delay(500); return Task.Delay(0); }
protected override void OnNavigatingFrom(MtNavigatingCancelEventArgs args) { MediaElement.Pause(); }
private async Task<bool> RaisePageOnNavigatingFromAsync(MtPageDescription description, NavigationMode mode) { var page = description.GetPage(this); var args = new MtNavigatingCancelEventArgs(); args.Content = page; args.SourcePageType = description.Type; args.NavigationMode = mode; IsNavigating = true; await page.OnNavigatingFromCoreAsync(args); IsNavigating = false; return args.Cancel; }
internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e) { OnNavigatingFrom(e); var task = OnNavigatingFromAsync(e); if (task != null) await task; }
/// <summary>Called when navigating from this page. /// The navigation does no happen until the returned task has completed. /// Return null or empty task to run the method synchronously. </summary> /// <param name="args">The event arguments. </param> /// <returns>The task. </returns> protected internal virtual Task OnNavigatingFromAsync(MtNavigatingCancelEventArgs args) { // Must be empty return null; }
/// <summary>Called when navigating from this page. </summary> /// <param name="args">The event arguments. </param> protected internal virtual void OnNavigatingFrom(MtNavigatingCancelEventArgs args) { // Must be empty }
/// <summary>Called when navigating from this page. /// The navigation does no happen until the returned task has completed. /// Return null or empty task to run the method synchronously. </summary> /// <param name="args">The event arguments. </param> /// <returns>The task. </returns> protected internal virtual Task OnNavigatingFromAsync(MtNavigatingCancelEventArgs args) { // Must be empty return(null); }
protected internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e) { #if DEBUG Debug.WriteLine("1. OnNavigatingFrom:" + GetType().FullName); #endif OnNavigatingFrom(e); var task = OnNavigatingFromAsync(e); if (task != null) await task; }
private async Task<bool> RaisePageOnNavigatingFromAsync(MtPageDescription currentPage, MtPageDescription targetPage, NavigationMode mode) { var page = currentPage.GetPage(this); var args = new MtNavigatingCancelEventArgs(); args.Content = page; args.SourcePageType = currentPage.Type; args.NavigationMode = mode; args.Parameter = currentPage.Parameter; await page.OnNavigatingFromCoreAsync(args); if (!args.Cancel && targetPage != null) { var args2 = new MtNavigatingCancelEventArgs(); args2.SourcePageType = targetPage.Type; args2.NavigationMode = mode; args2.Parameter = targetPage.Parameter; var copy = Navigating; if (copy != null) { copy(this, args2); args.Cancel = args2.Cancel; } } return args.Cancel; }
protected override void OnNavigatingFrom(MtNavigatingCancelEventArgs args) { SettingsPane.GetForCurrentView().CommandsRequested -= OnSettingsCommandsRequested; }