示例#1
0
 private void AddNewPageToGridIfNotSequential(PageInsertionMode insertionMode, MtPageDescription newPage)
 {
     if (insertionMode == PageInsertionMode.ConcurrentAbove)
     {
         ContentGrid.Children.Add(newPage.GetPage(this).InternalPage);
     }
     else if (insertionMode == PageInsertionMode.ConcurrentBelow)
     {
         ContentGrid.Children.Insert(0, newPage.GetPage(this).InternalPage);
     }
 }
示例#2
0
        private void RaisePageOnNavigatedTo(MtPageDescription description, NavigationMode mode)
        {
            var page = description.GetPage(this);

            var args = new MtNavigationEventArgs();

            args.Content        = page;
            args.SourcePageType = description.Type;
            args.Parameter      = description.Parameter;
            args.NavigationMode = mode;
            page.OnNavigatedToCore(args);

            var copy = Navigated;

            if (copy != null)
            {
                copy(this, args);
            }

            OnNavigated(this, args);

            if (args.NavigationMode == NavigationMode.New)
            {
                OnPageCreated(this, page);
            }
        }
示例#3
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);
        }
示例#4
0
 private async Task AnimateNavigatedFromIfCurrentPageNotNull(IPageAnimation pageAnimation, NavigationMode navigationMode,
                                                             PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
 {
     if (currentPage != null)
     {
         if (insertionMode != PageInsertionMode.Sequential)
         {
             await AnimateNavigatingFromAsync(pageAnimation, navigationMode,
                                              currentPage.GetPage(this).ActualAnimationContext,
                                              insertionMode != PageInsertionMode.Sequential?newPage.GetPage(this).ActualAnimationContext : null);
         }
         else
         {
             await AnimateNavigatingFromAsync(pageAnimation, navigationMode, currentPage.GetPage(this).ActualAnimationContext, null);
         }
     }
 }
示例#5
0
        private async Task AnimateNavigatedToAndRemoveCurrentPageAsync(IPageAnimation pageAnimation, NavigationMode navigationMode, PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
        {
            if (currentPage != null)
            {
                if (insertionMode != PageInsertionMode.Sequential)
                {
                    await AnimateNavigatedToAsync(pageAnimation, navigationMode,
                                                  currentPage.GetPage(this).ActualAnimationContext,
                                                  newPage.GetPage(this).ActualAnimationContext);

                    ContentGrid.Children.Remove(currentPage.GetPage(this).InternalPage);
                }
                else
                {
                    await AnimateNavigatedToAsync(pageAnimation, navigationMode, null,
                                                  newPage.GetPage(this).ActualAnimationContext);
                }
            }
        }
示例#6
0
 private void SwitchPagesIfSequential(PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
 {
     if (insertionMode == PageInsertionMode.Sequential)
     {
         if (currentPage != null)
         {
             ContentGrid.Children.Remove(currentPage.GetPage(this).InternalPage);
         }
         ContentGrid.Children.Add(newPage.GetPage(this).InternalPage);
     }
 }
示例#7
0
        private void RaisePageOnNavigatedFrom(MtPageDescription description, NavigationMode mode)
        {
            var page = description.GetPage(this);

            var args = new MtNavigationEventArgs();

            args.Content        = page;
            args.SourcePageType = description.Type;
            args.Parameter      = description.Parameter;
            args.NavigationMode = mode;

            page.OnNavigatedFromCore(args);
        }
示例#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
        private void RaisePageOnNavigatedTo(MtPageDescription description, NavigationMode mode)
        {
            var page = description.GetPage(this);

            var args = new MtNavigationEventArgs();
            args.Content = page;
            args.SourcePageType = description.Type;
            args.Parameter = description.Parameter;
            args.NavigationMode = mode;
            page.OnNavigatedToCore(args);

            var copy = Navigated;
            if (copy != null)
                copy(this, args);

            OnNavigated(this, args);

            if (args.NavigationMode == NavigationMode.New)
                OnPageCreated(this, page);
        }
示例#10
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;
        }
示例#11
0
        internal void RaisePageOnNavigatedFrom(MtPageDescription description, NavigationMode mode)
        {
            var page = description.GetPage(this);

            var args = new MtNavigationEventArgs();
            args.Content = page;
            args.SourcePageType = description.Type;
            args.Parameter = description.Parameter;
            args.NavigationMode = mode;

            page.OnNavigatedFromCore(args);
        }
示例#12
0
        private async Task AnimateNavigatedToAndRemoveCurrentPageAsync(IPageAnimation pageAnimation, NavigationMode navigationMode, PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
        {
            if (currentPage != null)
            {
                if (insertionMode != PageInsertionMode.Sequential)
                {
                    await AnimateNavigatedToAsync(pageAnimation, navigationMode,
                        currentPage.GetPage(this).ActualAnimationContext,
                        newPage.GetPage(this).ActualAnimationContext);

                    ContentGrid.Children.Remove(currentPage.GetPage(this).InternalPage);
                }
                else
                {
                    await AnimateNavigatedToAsync(pageAnimation, navigationMode, null,
                        newPage.GetPage(this).ActualAnimationContext);
                }
            }
        }
示例#13
0
 private void SwitchPagesIfSequential(PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
 {
     if (insertionMode == PageInsertionMode.Sequential)
     {
         if (currentPage != null)
             ContentGrid.Children.Remove(currentPage.GetPage(this).InternalPage);
         ContentGrid.Children.Add(newPage.GetPage(this).InternalPage);
     }
 }
示例#14
0
 private async Task AnimateNavigatedFromIfCurrentPageNotNull(IPageAnimation pageAnimation, NavigationMode navigationMode,
     PageInsertionMode insertionMode, MtPageDescription currentPage, MtPageDescription newPage)
 {
     if (currentPage != null)
     {
         if (insertionMode != PageInsertionMode.Sequential)
         {
             await AnimateNavigatingFromAsync(pageAnimation, navigationMode,
                 currentPage.GetPage(this).ActualAnimationContext,
                 insertionMode != PageInsertionMode.Sequential ? newPage.GetPage(this).ActualAnimationContext : null);
         }
         else
         {
             await AnimateNavigatingFromAsync(pageAnimation, navigationMode, currentPage.GetPage(this).ActualAnimationContext, null);
         }
     }
 }
示例#15
0
 private void AddNewPageToGridIfNotSequential(PageInsertionMode insertionMode, MtPageDescription newPage)
 {
     if (insertionMode == PageInsertionMode.ConcurrentAbove)
         ContentGrid.Children.Add(newPage.GetPage(this).InternalPage);
     else if (insertionMode == PageInsertionMode.ConcurrentBelow)
         ContentGrid.Children.Insert(0, newPage.GetPage(this).InternalPage);
 }
示例#16
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;
        }