public async Task Test_PopPage_Modal()
		{
			var mainPageViewModel = new MockFreshBasePageModel();
			var mainPage = new MockContentPage();
			var detailsPage = new MockContentPage();
			var navigation = new FreshNavigationContainer(mainPage);

			await navigation.PushPage(detailsPage, mainPageViewModel, true);

			Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(1));

			await navigation.PopPage(true);

			Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(0));
		}
        public async Task Test_PopPage_Modal()
        {
            var mainPageViewModel = new MockFreshBasePageModel();
            var mainPage          = new MockContentPage();
            var detailsPage       = new MockContentPage();
            var navigation        = new FreshNavigationContainer(mainPage);

            await navigation.PushPage(detailsPage, mainPageViewModel, true);

            Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(1));

            await navigation.PopPage(true);

            Assert.That(navigation.Navigation.ModalStack.Count, Is.EqualTo(0));
        }
		public async Task Test_PopPage()
		{
			var mainPageViewModel = new MockFreshBasePageModel();
			var mainPage = new MockContentPage();
			var detailsPage = new MockContentPage();
			var navigation = new FreshNavigationContainer(mainPage);

			await navigation.PushPage(detailsPage, mainPageViewModel);
			await navigation.PopPage();

			var page = navigation.Navigation.NavigationStack.FirstOrDefault(p => p.Id.Equals(detailsPage.Id));
			var firstPage = navigation.Navigation.NavigationStack.FirstOrDefault();

			Assert.IsNull(page);
			Assert.IsNotNull(firstPage);
			Assert.AreSame(mainPage, firstPage);
		}
        public async Task Test_PopPage()
        {
            var mainPageViewModel = new MockFreshBasePageModel();
            var mainPage          = new MockContentPage();
            var detailsPage       = new MockContentPage();
            var navigation        = new FreshNavigationContainer(mainPage);

            await navigation.PushPage(detailsPage, mainPageViewModel);

            await navigation.PopPage();

            var page      = navigation.Navigation.NavigationStack.FirstOrDefault(p => p.Id.Equals(detailsPage.Id));
            var firstPage = navigation.Navigation.NavigationStack.FirstOrDefault();

            Assert.IsNull(page);
            Assert.IsNotNull(firstPage);
            Assert.AreSame(mainPage, firstPage);
        }
Пример #5
0
        private async void HandleConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
        {
            IsConnected = e.IsConnected;

            var noNetwork = FreshPageModelResolver.ResolvePageModel <NoNetworkPageModel>();

            if (IsConnected)
            {
                if (navContainer.Navigation.ModalStack.LastOrDefault().GetType() == typeof(NoNetworkPage))
                {
                    await navContainer.PopPage(true);
                }
            }
            else
            {
                if (navContainer.Navigation.ModalStack.LastOrDefault().GetType() != typeof(NoNetworkPage))
                {
                    await navContainer.PushPage(noNetwork, noNetwork.GetModel(), true);
                }
            }
        }