예제 #1
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();
        }
예제 #2
0
        public void AppearingOnShellSectionChanged()
        {
            Shell shell      = new Shell();
            var   item       = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            var   section    = item.SearchForRoute <ShellSection>(SectionRoute);
            var   newSection = CreateShellSection();

            item.Items.Insert(0, newSection);
            item.CurrentItem = newSection;
            shell.Items.Add(item);
            ShellLifeCycleState state = new ShellLifeCycleState(shell);

            state.AllFalse();


            Assert.AreEqual(newSection, item.CurrentItem);
            Assert.AreNotEqual(section, item.CurrentItem);

            item.CurrentItem = section;

            Assert.IsTrue(state.SectionAppearing);
            Assert.IsTrue(state.ContentAppearing);

            item.CurrentItem = newSection;

            Assert.IsFalse(state.SectionAppearing);
            Assert.IsFalse(state.ContentAppearing);
        }
예제 #3
0
        public void AppearingOnShellItemChanged()
        {
            Shell shell = new Shell();
            var   item  = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            var   item2 = CreateShellItem();

            shell.Items.Add(item2);
            shell.Items.Add(item);
            ShellLifeCycleState state = new ShellLifeCycleState(shell);

            state.AllFalse();

            Assert.AreEqual(shell.CurrentItem, item2);
            Assert.AreNotEqual(shell.CurrentItem, item);

            shell.CurrentItem = item;

            Assert.IsTrue(state.ItemAppearing);
            Assert.IsTrue(state.SectionAppearing);
            Assert.IsTrue(state.ContentAppearing);

            shell.CurrentItem = item2;

            Assert.IsFalse(state.ItemAppearing);
            Assert.IsFalse(state.SectionAppearing);
            Assert.IsFalse(state.ContentAppearing);
        }
예제 #4
0
        public void AppearingOnShellContentChanged()
        {
            Shell shell   = new Shell();
            var   item    = CreateShellItem(shellContentRoute: ContentRoute, shellSectionRoute: SectionRoute, shellItemRoute: ItemRoute);
            var   section = item.SearchForRoute <ShellSection>(SectionRoute);

            var content = new ShellContent();

            section.Items.Insert(0, content);
            section.CurrentItem = content;
            shell.Items.Add(item);
            ShellLifeCycleState state = new ShellLifeCycleState(shell);

            state.AllFalse();

            Assert.AreEqual(content, section.CurrentItem);

            section.CurrentItem = shell.SearchForRoute <ShellContent>(ContentRoute);

            Assert.IsTrue(state.ContentAppearing);

            section.CurrentItem = content;

            Assert.IsFalse(state.ContentAppearing);
        }
예제 #5
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();
        }