From 723c4bc2f129d3404442f241698ce3d4786c55aa Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Mon, 13 Apr 2020 04:33:32 -0600 Subject: [PATCH] Dualscreen updates to new apis and add hinge angle for UWP (#10244) * Dual Screen sdk updates - update to newer windows sdk apis - Add Hinge Angle Events * - remove reflection call --- UWP.Build.props | 22 +- UWP.Build.targets | 7 +- .../CustomRenderers.cs | 51 ---- .../TwoPanePropertiesGallery.xaml | 4 +- .../TwoPanePropertiesGallery.xaml.cs | 16 +- .../DualScreenHelper.uwp.cs | 4 +- .../DualScreenInfo.android.cs | 26 ++ .../DualScreenInfo.netstandard.cs | 16 ++ .../DualScreenInfo.shared.cs | 41 +++- .../DualScreenInfo.uwp.cs | 63 +++++ .../DualScreenService.android.cs | 225 ++++++++++++------ .../DualScreenService.uwp.cs | 137 ++++++++--- .../Xamarin.Forms.DualScreen.csproj | 9 - .../Xamarin.Forms.Platform.UAP.csproj | 10 +- 14 files changed, 443 insertions(+), 188 deletions(-) create mode 100644 Xamarin.Forms.DualScreen/DualScreenInfo.netstandard.cs create mode 100644 Xamarin.Forms.DualScreen/DualScreenInfo.uwp.cs diff --git a/UWP.Build.props b/UWP.Build.props index f7762a17c..a96966cf4 100644 --- a/UWP.Build.props +++ b/UWP.Build.props @@ -1,11 +1,27 @@ - - uap10.0.14393;uap10.0.16299; + + $(UwpMinTargetFrameworks) + + + uap10.0.14393;uap10.0.16299 + netstandard2.0 + + 10.0.16299.0 10.0.18362.0 + 10.0.19559.0 - + + $(DefineConstants);UWP + + $(DefineConstants);UWP_14393 + + $(DefineConstants);UWP_18362 + + + $(DefineConstants);UWP_18362;UWP_19000 + diff --git a/UWP.Build.targets b/UWP.Build.targets index 8fd6159a1..614d6a57b 100644 --- a/UWP.Build.targets +++ b/UWP.Build.targets @@ -2,11 +2,16 @@ - + Windows Mobile Extensions for the UWP + + + Windows Mobile Extensions for the UWP + + diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs index c6fd57b80..2d67cf9e2 100644 --- a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs +++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs @@ -56,7 +56,6 @@ using Android.Support.V4.Content; [assembly: ExportRenderer(typeof(ShellGestures.TouchTestView), typeof(ShellGesturesTouchTestViewRenderer))] [assembly: ExportRenderer(typeof(Issue7249Switch), typeof(Issue7249SwitchRenderer))] [assembly: ExportRenderer(typeof(Issue9360.Issue9360NavigationPage), typeof(Issue9360NavigationPageRenderer))] -[assembly: ExportRenderer(typeof(Xamarin.Forms.Controls.GalleryPages.TwoPaneViewGalleries.HingeAngleLabel), typeof(HingeAngleLabelRenderer))] [assembly: ExportRenderer(typeof(Xamarin.Forms.Controls.Tests.TestClasses.CustomButton), typeof(CustomButtonRenderer))] [assembly: ExportRenderer(typeof(Issue8801.PopupStackLayout), typeof(CustomStackLayoutRenderer))] @@ -67,56 +66,6 @@ using Android.Support.V4.Content; #endif namespace Xamarin.Forms.ControlGallery.Android { - public class HingeAngleLabelRenderer : Xamarin.Forms.Platform.Android.FastRenderers.LabelRenderer - { - System.Timers.Timer _hingeTimer; - public HingeAngleLabelRenderer(Context context) : base(context) - { - } - - async void OnTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) - { - if (_hingeTimer == null) - return; - - _hingeTimer.Stop(); - var hingeAngle = await DualScreen.DualScreenInfo.Current.GetHingeAngleAsync(); - - Device.BeginInvokeOnMainThread(() => - { - if (_hingeTimer != null) - Element.Text = hingeAngle.ToString(); - }); - - if(_hingeTimer != null) - _hingeTimer.Start(); - } - - protected override void OnElementChanged(ElementChangedEventArgs - + MSBuild:Compile Designer - + @@ -114,11 +114,11 @@ - - + + 2.1.190606001 - + 2.3.191211002