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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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; }
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); } }
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); }
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); }