예제 #1
0
        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);
        }
예제 #2
0
        internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e)
        {
            OnNavigatingFrom(e);

            var task = OnNavigatingFromAsync(e);

            if (task != null)
            {
                await task;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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);
 }
예제 #7
0
 protected override void OnNavigatingFrom(MtNavigatingCancelEventArgs args)
 {
     MediaElement.Pause();
 }
예제 #8
0
        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;
        }
예제 #9
0
        internal virtual async Task OnNavigatingFromCoreAsync(MtNavigatingCancelEventArgs e)
        {
            OnNavigatingFrom(e);

            var task = OnNavigatingFromAsync(e);
            if (task != null)
                await task;
        }
예제 #10
0
 /// <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;
 }
예제 #11
0
 /// <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
 }
예제 #12
0
 /// <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);
 }
예제 #13
0
 /// <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
 }
예제 #14
0
        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;
        }
예제 #15
0
        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;
        }
예제 #16
0
 protected override void OnNavigatingFrom(MtNavigatingCancelEventArgs args)
 {
     SettingsPane.GetForCurrentView().CommandsRequested -= OnSettingsCommandsRequested;
 }