Пример #1
0
        public async Task NavigateToMenu(INavigation navigation)
        {
            MenuCoordinator.RaiseMenuSelected(this);

            if (_justNotifyNavigateIntent)
            {
                return;
            }

            if (_customNavigation != null)
            {
                _customNavigation(navigation);
                return;
            }

            int popCount            = 0;
            int firstPageToPopIndex = 0;

            for (int i = navigation.NavigationStack.Count - 1; i >= 0; i--)
            {
                if (navigation.NavigationStack[i].GetType() == _pageType)
                {
                    firstPageToPopIndex = i + 1;
                    popCount            = navigation.NavigationStack.Count - 1 - i;
                    break;
                }
            }

            if (popCount > 0)
            {
                for (int i = 1; i < popCount; i++)
                {
                    navigation.RemovePage(navigation.NavigationStack[firstPageToPopIndex]);
                }

                await navigation.PopAsync();

                return;
            }

            var page = CreateContentPage();

            if (_modal)
            {
                await navigation.PushModalAsync(new NavigationPage(page));
            }
            else
            {
                await navigation.PushAsync(page);
            }
        }
Пример #2
0
 private static void RootPageCustomNavigation(INavigation navigation)
 {
     MenuCoordinator.RaisePresentMainMenuOnAppearance();
     navigation.PopToRootAsync();
 }