コード例 #1
0
        public async Task ShellPartWithPagePush()
        {
            Shell shell = new Shell();
            var   item  = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            ShellLifeCycleState lifeCycleState = new ShellLifeCycleState(item);

            shell.Items.Add(item);

            lifeCycleState.AllTrue();

            await shell.Navigation.PushAsync(new ContentPage());

            //if you're just pushing a page then the section and item are still visible but the content is not
            Assert.IsFalse(lifeCycleState.PageAppearing);
            Assert.IsFalse(lifeCycleState.ContentAppearing);
            Assert.IsTrue(lifeCycleState.SectionAppearing);
            Assert.IsTrue(lifeCycleState.ItemAppearing);

            await shell.Navigation.PushAsync(new ContentPage());

            Assert.IsFalse(lifeCycleState.PageAppearing);
            Assert.IsFalse(lifeCycleState.ContentAppearing);
            Assert.IsTrue(lifeCycleState.SectionAppearing);
            Assert.IsTrue(lifeCycleState.ItemAppearing);

            await shell.Navigation.PopAsync();

            Assert.IsFalse(lifeCycleState.PageAppearing);
            Assert.IsFalse(lifeCycleState.ContentAppearing);
            Assert.IsTrue(lifeCycleState.SectionAppearing);
            Assert.IsTrue(lifeCycleState.ItemAppearing);
            await shell.Navigation.PopAsync();

            lifeCycleState.AllTrue();
        }
コード例 #2
0
        public async Task ShellPartWithPopToRoot()
        {
            Shell shell = new Shell();
            var   item  = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            ShellLifeCycleState lifeCycleState = new ShellLifeCycleState(item);

            shell.Items.Add(item);

            lifeCycleState.AllTrue();

            await shell.Navigation.PushAsync(new ContentPage());

            await shell.Navigation.PushAsync(new ContentPage());

            await shell.Navigation.PushAsync(new ContentPage());

            await shell.Navigation.PushAsync(new ContentPage());

            Assert.IsFalse(lifeCycleState.PageAppearing);
            Assert.IsFalse(lifeCycleState.ContentAppearing);
            Assert.IsTrue(lifeCycleState.SectionAppearing);
            Assert.IsTrue(lifeCycleState.ItemAppearing);

            await shell.Navigation.PopToRootAsync();

            lifeCycleState.AllTrue();
        }
コード例 #3
0
        public async Task PagePushModal()
        {
            Shell shell = new Shell();
            var   item  = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            ShellLifeCycleState lifeCycleState = new ShellLifeCycleState(item);

            shell.Items.Add(item);

            ContentPage page = new ContentPage();

            bool appearing = false;

            page.Appearing    += (_, __) => appearing = true;
            page.Disappearing += (_, __) => appearing = false;

            await shell.Navigation.PushModalAsync(page);

            Assert.IsTrue(appearing);
            lifeCycleState.AllFalse();

            await shell.Navigation.PopModalAsync();

            Assert.IsFalse(appearing);
            lifeCycleState.AllTrue();
        }
コード例 #4
0
        public async Task ShellPartWithModalPush()
        {
            Shell shell = new Shell();
            var   item  = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            ShellLifeCycleState lifeCycleState = new ShellLifeCycleState(item);

            shell.Items.Add(item);

            lifeCycleState.AllTrue();

            ContentPage page = new ContentPage();
            await shell.Navigation.PushModalAsync(page);

            lifeCycleState.AllFalse();
            await shell.Navigation.PopModalAsync();

            lifeCycleState.AllTrue();
        }