TwoPaneView CreateTwoPaneView(TestDualScreenService dualScreenService, View pane1 = null, View pane2 = null)
        {
            pane1 = pane1 ?? new BoxView();
            pane2 = pane2 ?? new BoxView();
            dualScreenService.IsSpanned = true;

            TwoPaneView view = new TwoPaneView(dualScreenService)
            {
                IsPlatformEnabled = true,
                Pane1             = pane1,
                Pane2             = pane2
            };

            view.MinTallModeHeight = 4000;
            view.MinWideModeWidth  = 4000;

            if (pane1 != null)
            {
                pane1.IsPlatformEnabled = true;
            }

            if (pane2 != null)
            {
                pane2.IsPlatformEnabled = true;
            }

            view.Children[0].IsPlatformEnabled = true;
            view.Children[1].IsPlatformEnabled = true;

            return(view);
        }
Пример #2
0
        public void PanePriority()
        {
            var pane1 = new BoxView();
            var pane2 = new BoxView();

            TwoPaneView twoPaneView = CreateTwoPaneView(pane1, pane2);

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));
            twoPaneView.MinWideModeWidth  = 500;
            twoPaneView.MinTallModeHeight = 500;

            Assert.IsFalse(twoPaneView.Children[1].IsVisible);
            Assert.IsTrue(twoPaneView.Children[0].IsVisible);

            Assert.AreEqual(pane1.Height, 300);
            Assert.AreEqual(pane1.Width, 300);

            twoPaneView.PanePriority = TwoPaneViewPriority.Pane2;

            Assert.AreEqual(pane2.Height, 300);
            Assert.AreEqual(pane2.Width, 300);

            Assert.IsFalse(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);
        }
Пример #3
0
        public void WideModeConfiguration()
        {
            var         pane1       = new BoxView();
            var         pane2       = new BoxView();
            TwoPaneView twoPaneView = CreateTwoPaneView(pane1, pane2);

            twoPaneView.MinWideModeWidth = 100;
            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));

            Assert.AreEqual(0, twoPaneView.Children[0].Bounds.X);
            Assert.AreEqual(150, twoPaneView.Children[1].Bounds.X);

            twoPaneView.WideModeConfiguration = TwoPaneViewWideModeConfiguration.RightLeft;

            Assert.AreEqual(150, twoPaneView.Children[0].Bounds.X);
            Assert.AreEqual(0, twoPaneView.Children[1].Bounds.X);

            twoPaneView.WideModeConfiguration = TwoPaneViewWideModeConfiguration.SinglePane;

            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsFalse(twoPaneView.Children[1].IsVisible);

            twoPaneView.PanePriority = TwoPaneViewPriority.Pane2;

            Assert.IsFalse(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);

            twoPaneView.PanePriority = TwoPaneViewPriority.Pane1;

            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsFalse(twoPaneView.Children[1].IsVisible);
        }
Пример #4
0
        TwoPaneView CreateTwoPaneView(View pane1 = null, View pane2 = null, IDualScreenService dualScreenService = null)
        {
            dualScreenService = dualScreenService ?? new TestDualScreenServicePortrait();
            pane1             = pane1 ?? new BoxView();
            pane2             = pane2 ?? new BoxView();

            TwoPaneView view = new TwoPaneView(dualScreenService)
            {
                IsPlatformEnabled = true,
                Pane1             = pane1,
                Pane2             = pane2
            };

            if (pane1 != null)
            {
                pane1.IsPlatformEnabled = true;
            }

            if (pane2 != null)
            {
                pane2.IsPlatformEnabled = true;
            }

            view.Children[0].IsPlatformEnabled = true;
            view.Children[1].IsPlatformEnabled = true;

            return(view);
        }
Пример #5
0
        public void TallModeConfiguration()
        {
            var         pane1       = new BoxView();
            var         pane2       = new BoxView();
            TwoPaneView twoPaneView = CreateTwoPaneView(pane1, pane2);

            twoPaneView.MinTallModeHeight = 100;
            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));

            Assert.AreEqual(0, twoPaneView.Children[0].Bounds.Y);
            Assert.AreEqual(150, twoPaneView.Children[1].Bounds.Y);

            twoPaneView.TallModeConfiguration = TwoPaneViewTallModeConfiguration.BottomTop;

            Assert.AreEqual(150, twoPaneView.Children[0].Bounds.Y);
            Assert.AreEqual(0, twoPaneView.Children[1].Bounds.Y);

            twoPaneView.TallModeConfiguration = TwoPaneViewTallModeConfiguration.SinglePane;

            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsFalse(twoPaneView.Children[1].IsVisible);

            twoPaneView.PanePriority = TwoPaneViewPriority.Pane2;

            Assert.IsFalse(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);

            twoPaneView.PanePriority = TwoPaneViewPriority.Pane1;

            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsFalse(twoPaneView.Children[1].IsVisible);
        }
Пример #6
0
        public void BasicLayoutTestPortrait()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));

            Assert.AreEqual(300, twoPaneView.Pane1.Width);
            Assert.AreEqual(500, twoPaneView.Pane1.Height);
        }
Пример #7
0
        public void BasicLayoutTest()
        {
            TwoPaneView twoPaneView = new TwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));

            Assert.AreEqual(300, twoPaneView.Height);
            Assert.AreEqual(300, twoPaneView.Width);
        }
Пример #8
0
        public void BasicLayoutTestLandscape()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView(dualScreenService: new TestDualScreenServiceLandscape());

            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));

            Assert.AreEqual(300, twoPaneView.Width);
            Assert.AreEqual(500, twoPaneView.Height);
        }
Пример #9
0
        public void ModeSwitchesWithMinTallModeHeight()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));

            twoPaneView.MinTallModeHeight = 400;
            Assert.AreEqual(TwoPaneViewMode.SinglePane, twoPaneView.Mode);
            twoPaneView.MinTallModeHeight = 100;
            Assert.AreEqual(TwoPaneViewMode.Tall, twoPaneView.Mode);
        }
Пример #10
0
        public void ModeSwitchesWithMinWideModeWidth()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));

            twoPaneView.MinWideModeWidth = 400;
            Assert.AreEqual(TwoPaneViewMode.SinglePane, twoPaneView.Mode);
            twoPaneView.MinWideModeWidth = 100;
            Assert.AreEqual(TwoPaneViewMode.Wide, twoPaneView.Mode);
        }
Пример #11
0
        public void BasicLayoutTestSinglePaneLandscape()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView(dualScreenService: new TestDualScreenServiceLandscape());

            twoPaneView.MinWideModeWidth  = 1000;
            twoPaneView.MinTallModeHeight = 1000;
            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));

            Assert.AreEqual(300, twoPaneView.Pane1.Width);
            Assert.AreEqual(500, twoPaneView.Pane1.Height);
        }
Пример #12
0
        public void BasicLayoutTestSinglePanePortrait()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.MinWideModeWidth  = 1000;
            twoPaneView.MinTallModeHeight = 1000;
            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));

            Assert.AreEqual(300, twoPaneView.Pane1.Width);
            Assert.AreEqual(500, twoPaneView.Pane1.Height);
        }
Пример #13
0
        public void Pane2LengthWideMode()
        {
            var pane1 = new BoxView();
            var pane2 = new BoxView();

            TwoPaneView twoPaneView = CreateTwoPaneView(pane1, pane2);

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));
            twoPaneView.MinWideModeWidth = 100;
            Assert.AreNotEqual(100, twoPaneView.Pane2.Width);
            twoPaneView.Pane2Length = 100;
            Assert.AreEqual(100, twoPaneView.Pane2.Width);
        }
Пример #14
0
        public void Pane1LengthTallMode()
        {
            var pane1 = new BoxView();
            var pane2 = new BoxView();

            TwoPaneView twoPaneView = CreateTwoPaneView(pane1, pane2);

            twoPaneView.Layout(new Rectangle(0, 0, 300, 300));
            twoPaneView.MinTallModeHeight = 100;
            Assert.AreNotEqual(100, twoPaneView.Pane1.Height);
            twoPaneView.Pane1Length = 100;
            Assert.AreEqual(100, twoPaneView.Pane1.Height);
        }
Пример #15
0
        public void Pane2BecomesVisibleAfterOnlyPane1IsVisibleTallMode()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));
            twoPaneView.MinTallModeHeight = 4000;
            twoPaneView.PanePriority      = TwoPaneViewPriority.Pane1;

            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsFalse(twoPaneView.Children[1].IsVisible);
            twoPaneView.MinTallModeHeight = 0;
            Assert.AreEqual(twoPaneView.Mode, TwoPaneViewMode.Tall);
            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);
        }
Пример #16
0
        public void Pane1BecomesVisibleAfterOnlyPane2IsVisibleWideMode()
        {
            TwoPaneView twoPaneView = CreateTwoPaneView();

            twoPaneView.Layout(new Rectangle(0, 0, 300, 500));
            twoPaneView.MinWideModeWidth = 4000;
            twoPaneView.PanePriority     = TwoPaneViewPriority.Pane2;

            Assert.IsFalse(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);
            twoPaneView.MinWideModeWidth = 0;
            Assert.AreEqual(twoPaneView.Mode, TwoPaneViewMode.Wide);
            Assert.IsTrue(twoPaneView.Children[0].IsVisible);
            Assert.IsTrue(twoPaneView.Children[1].IsVisible);
        }
Пример #17
0
        public TwoPaneViewGallery()
        {
            if (Application.Current.MainPage is MasterDetailPage mdp)
            {
                mdp.MasterBehavior = MasterBehavior.Popover;
                mdp.IsPresented    = false;
            }

            var twoPaneView = new TwoPaneView()
            {
                MinTallModeHeight = 0,
                MinWideModeWidth  = 0
            };

            var pane1 = new StackLayout
            {
                Children =
                {
                    NavButton("TwoPanePropertiesGallery", () => new TwoPanePropertiesGallery(), Navigation),
                    NavButton("Master Details Sample",    () => new MasterDetail(),             Navigation),
                    NavButton("Companion Pane",           () => new CompanionPane(),            Navigation),
                    NavButton("ExtendCanvas Sample",      () => new ExtendCanvas(),             Navigation),
                    NavButton("DualViewMapPage Sample",   () => new DualViewMapPage(),          Navigation),
                    NavButton("Lots of TwoPaneViews",     () => new TwoPaneViewBonanza(),       Navigation),
                }
            };

            var pane2 = new StackLayout
            {
                Children =
                {
                    NavButton("Nested TwoPaneView Split Across Hinge", () => new NestedTwoPaneViewSplitAcrossHinge(), Navigation),
                    NavButton("DualScreenInfo with non TwoPaneView",   () => new GridUsingDualScreenInfo(),           Navigation),
                    NavButton("eReader Samples",                       () => new TwoPage(),                           Navigation),
                    NavButton("Dual Screen Info Samples",              () => new DualScreenInfoGallery(),             Navigation),
                    StyleButton(new Button()
                    {
                        Text = "Collect Garbage",                      Command = new Command(OnCollectGarbage)
                    })
                }
            };

            twoPaneView.Pane1 = pane1;
            twoPaneView.Pane2 = pane2;

            Content = twoPaneView;
        }
Пример #18
0
        private void TwoPaneView_ModeChanged(TwoPaneView sender, object args)
        {
            if (ThisChatPanel.Visibility == Visibility.Visible)
            {
                TwoPaneView.PanePriority = TwoPaneViewPriority.Pane2;
            }

            if (TwoPaneView.Mode == TwoPaneViewMode.SinglePane)
            {
                if (TwoPaneView.PanePriority == TwoPaneViewPriority.Pane2)
                {
                    TitleTextBlock.Margin = new Thickness(12, 0, 0, 0);
                }
            }
            else
            {
                TitleTextBlock.Margin = new Thickness(76, 0, 0, 0);
            }
        }
Пример #19
0
        public void GettersAndSetters()
        {
            var Pane1 = new StackLayout();
            var Pane2 = new Grid();

            TwoPaneView twoPaneView = CreateTwoPaneView(Pane1, Pane2);

            twoPaneView.TallModeConfiguration = TwoPaneViewTallModeConfiguration.SinglePane;
            twoPaneView.WideModeConfiguration = TwoPaneViewWideModeConfiguration.SinglePane;
            twoPaneView.Pane1             = Pane1;
            twoPaneView.Pane2             = Pane2;
            twoPaneView.PanePriority      = TwoPaneViewPriority.Pane2;
            twoPaneView.MinTallModeHeight = 1000;
            twoPaneView.MinWideModeWidth  = 2000;


            Assert.AreEqual(TwoPaneViewTallModeConfiguration.SinglePane, twoPaneView.TallModeConfiguration);
            Assert.AreEqual(TwoPaneViewWideModeConfiguration.SinglePane, twoPaneView.WideModeConfiguration);
            Assert.AreEqual(Pane1, twoPaneView.Pane1);
            Assert.AreEqual(Pane2, twoPaneView.Pane2);
            Assert.AreEqual(TwoPaneViewPriority.Pane2, twoPaneView.PanePriority);
            Assert.AreEqual(1000, twoPaneView.MinTallModeHeight);
            Assert.AreEqual(2000, twoPaneView.MinWideModeWidth);
        }
Пример #20
0
        TwoPaneView CreateTwoPaneView(View pane1 = null, View pane2 = null)
        {
            TwoPaneView view = new TwoPaneView()
            {
                IsPlatformEnabled = true,
                Pane1             = pane1,
                Pane2             = pane2
            };

            if (pane1 != null)
            {
                pane1.IsPlatformEnabled = true;
            }

            if (pane2 != null)
            {
                pane2.IsPlatformEnabled = true;
            }

            view.Children[0].IsPlatformEnabled = true;
            view.Children[1].IsPlatformEnabled = true;

            return(view);
        }