From 50154238492759f3ceedd5f1dffba4ffb143982e Mon Sep 17 00:00:00 2001 From: Jonathan Chiu Date: Thu, 22 Aug 2019 17:14:46 -0700 Subject: [PATCH 1/4] Updating projects to support ARM64 --- .../CS/IoTCoreDefaultApp.sln | 20 +++++++++++++ .../SmartDisplay.Contracts.csproj | 26 +++++++++++++++- .../SmartDisplay.Features.csproj | 26 +++++++++++++++- .../SmartDisplay.Utils.csproj | 26 +++++++++++++++- .../CS/SmartDisplay/SmartDisplay.csproj | 30 +++++++++++++++++-- .../UIControls/BackdropBlurBrush.cs | 8 ++++- 6 files changed, 130 insertions(+), 6 deletions(-) diff --git a/Samples/IoTCoreDefaultApp/CS/IoTCoreDefaultApp.sln b/Samples/IoTCoreDefaultApp/CS/IoTCoreDefaultApp.sln index c79b549..2f2f82f 100644 --- a/Samples/IoTCoreDefaultApp/CS/IoTCoreDefaultApp.sln +++ b/Samples/IoTCoreDefaultApp/CS/IoTCoreDefaultApp.sln @@ -17,9 +17,11 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection @@ -27,6 +29,9 @@ Global {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM.ActiveCfg = Debug|ARM {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM.Build.0 = Debug|ARM {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM.Deploy.0 = Debug|ARM + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM64.Build.0 = Debug|ARM64 + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|ARM64.Deploy.0 = Debug|ARM64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|x64.ActiveCfg = Debug|x64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|x64.Build.0 = Debug|x64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Debug|x64.Deploy.0 = Debug|x64 @@ -36,6 +41,9 @@ Global {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM.ActiveCfg = Release|ARM {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM.Build.0 = Release|ARM {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM.Deploy.0 = Release|ARM + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM64.ActiveCfg = Release|ARM64 + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM64.Build.0 = Release|ARM64 + {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|ARM64.Deploy.0 = Release|ARM64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|x64.ActiveCfg = Release|x64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|x64.Build.0 = Release|x64 {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|x64.Deploy.0 = Release|x64 @@ -44,36 +52,48 @@ Global {A417FAF4-1000-4D83-9B35-D2AB6066E76E}.Release|x86.Deploy.0 = Release|x86 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|ARM.ActiveCfg = Debug|ARM {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|ARM.Build.0 = Debug|ARM + {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|ARM64.Build.0 = Debug|ARM64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|x64.ActiveCfg = Debug|x64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|x64.Build.0 = Debug|x64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|x86.ActiveCfg = Debug|x86 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Debug|x86.Build.0 = Debug|x86 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|ARM.ActiveCfg = Release|ARM {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|ARM.Build.0 = Release|ARM + {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|ARM64.ActiveCfg = Release|ARM64 + {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|ARM64.Build.0 = Release|ARM64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|x64.ActiveCfg = Release|x64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|x64.Build.0 = Release|x64 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|x86.ActiveCfg = Release|x86 {8DA90BDA-CE14-46A1-BC52-AD5A40AE0BCA}.Release|x86.Build.0 = Release|x86 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|ARM.ActiveCfg = Debug|ARM {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|ARM.Build.0 = Debug|ARM + {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|ARM64.Build.0 = Debug|ARM64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|x64.ActiveCfg = Debug|x64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|x64.Build.0 = Debug|x64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|x86.ActiveCfg = Debug|x86 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Debug|x86.Build.0 = Debug|x86 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|ARM.ActiveCfg = Release|ARM {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|ARM.Build.0 = Release|ARM + {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|ARM64.ActiveCfg = Release|ARM64 + {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|ARM64.Build.0 = Release|ARM64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|x64.ActiveCfg = Release|x64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|x64.Build.0 = Release|x64 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|x86.ActiveCfg = Release|x86 {9A45F2F2-0F2B-452A-887D-C39A22A3C3C2}.Release|x86.Build.0 = Release|x86 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|ARM.ActiveCfg = Debug|ARM {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|ARM.Build.0 = Debug|ARM + {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|ARM64.Build.0 = Debug|ARM64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|x64.ActiveCfg = Debug|x64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|x64.Build.0 = Debug|x64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|x86.ActiveCfg = Debug|x86 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Debug|x86.Build.0 = Debug|x86 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|ARM.ActiveCfg = Release|ARM {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|ARM.Build.0 = Release|ARM + {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|ARM64.ActiveCfg = Release|ARM64 + {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|ARM64.Build.0 = Release|ARM64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|x64.ActiveCfg = Release|x64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|x64.Build.0 = Release|x64 {4FE09537-3CF8-4012-87DB-D1F72CAB62B0}.Release|x86.ActiveCfg = Release|x86 diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj index 59ec334..667416b 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj @@ -129,7 +129,7 @@ 1.0.31 - 6.1.9 + 6.2.8 @@ -149,6 +149,30 @@ 14.0 + + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + true + full + ARM64 + false + prompt + MinimumRecommendedRules.ruleset + + + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + true + pdbonly + ARM64 + false + prompt + MinimumRecommendedRules.ruleset + + From b59d693f3c69a89f329cd6b0948e4076b5b1019f Mon Sep 17 00:00:00 2001 From: Jonathan Chiu Date: Tue, 10 Sep 2019 12:46:09 -0700 Subject: [PATCH 3/4] Manually add _M_ARM64 macro to ARM64 configurations --- .../SmartDisplay.Contracts.csproj | 2 +- .../SmartDisplay.Features.csproj | 2 +- .../SmartDisplay.Utils.csproj | 2 +- .../CS/SmartDisplay/SmartDisplay.csproj | 6 +- .../UIControls/BackdropBlurBrush.cs | 71 +++++++++---------- .../Settings/TileSettingsControl.xaml | 5 +- .../Settings/TileSettingsControlVM.cs | 7 ++ 7 files changed, 48 insertions(+), 47 deletions(-) diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj index 667416b..06c6876 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Contracts/SmartDisplay.Contracts.csproj @@ -129,7 +129,7 @@ 1.0.31 - 6.2.8 + 6.2.9 diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/SmartDisplay.Features.csproj b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/SmartDisplay.Features.csproj index a36b055..0cf6a8c 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/SmartDisplay.Features.csproj +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/SmartDisplay.Features.csproj @@ -121,7 +121,7 @@ - 6.2.8 + 6.2.9 1.2.0 diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Utils/SmartDisplay.Utils.csproj b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Utils/SmartDisplay.Utils.csproj index 88c0b7d..6f0f8f5 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Utils/SmartDisplay.Utils.csproj +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Utils/SmartDisplay.Utils.csproj @@ -124,7 +124,7 @@ 1.1.2-preview0008 - 6.2.8 + 6.2.9 diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/SmartDisplay.csproj b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/SmartDisplay.csproj index e0fb3d9..edc2217 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/SmartDisplay.csproj +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/SmartDisplay.csproj @@ -29,7 +29,7 @@ true bin\ARM64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS + TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;_M_ARM64 ;2008 true full @@ -41,7 +41,7 @@ bin\ARM64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;_M_ARM64 true ;2008 true @@ -616,7 +616,7 @@ 1.11.0 - 6.2.8 + 6.2.9 11.0.2 diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/BackdropBlurBrush.cs b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/BackdropBlurBrush.cs index 86e158a..3ea50a9 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/BackdropBlurBrush.cs +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/BackdropBlurBrush.cs @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// BUG: _M_ARM64 isn't defined when building ARM64 for some reason, so I'm just commenting everything out. -//#if !_M_ARM64 -//using Microsoft.Graphics.Canvas.Effects; -//#endif +#if !_M_ARM64 +using Microsoft.Graphics.Canvas.Effects; +#endif using Windows.UI; using Windows.UI.Composition; using Windows.UI.Xaml; @@ -63,47 +62,43 @@ namespace SmartDisplay.Controls // Delay creating composition resources until they're required. if (CompositionBrush == null) { - // BUG: _M_ARM64 isn't defined when building ARM64 for some reason, so I'm just commenting everything out. - //#if !_M_ARM64 - // var backdrop = Window.Current.Compositor.CreateBackdropBrush(); +#if !_M_ARM64 + var backdrop = Window.Current.Compositor.CreateBackdropBrush(); - // // Use a Win2D blur affect applied to a CompositionBackdropBrush. - // var graphicsEffect = new GaussianBlurEffect - // { - // Name = "Blur", - // BlurAmount = (float)BlurAmount, - // Source = new CompositionEffectSourceParameter("backdrop") - // }; + // Use a Win2D blur affect applied to a CompositionBackdropBrush. + var graphicsEffect = new GaussianBlurEffect + { + Name = "Blur", + BlurAmount = (float)BlurAmount, + Source = new CompositionEffectSourceParameter("backdrop") + }; - // var colorEffect = new ColorSourceEffect - // { - // Name = "Tint", - // Color = TintColor - // }; + var colorEffect = new ColorSourceEffect + { + Name = "Tint", + Color = TintColor + }; - // var blendEffect = new BlendEffect - // { - // Background = graphicsEffect, - // Foreground = colorEffect, - // Mode = BlendEffectMode.Overlay - // }; + var blendEffect = new BlendEffect + { + Background = graphicsEffect, + Foreground = colorEffect, + Mode = BlendEffectMode.Overlay + }; - // var effectFactory = Window.Current.Compositor.CreateEffectFactory(blendEffect, new[] - // { - // "Blur.BlurAmount", - // "Tint.Color" - // }); - // var effectBrush = effectFactory.CreateBrush(); - - // effectBrush.SetSourceParameter("backdrop", backdrop); - - // CompositionBrush = effectBrush; - //#else - // CompositionBrush = Window.Current.Compositor.CreateColorBrush(Colors.Black); - //#endif + var effectFactory = Window.Current.Compositor.CreateEffectFactory(blendEffect, new[] + { + "Blur.BlurAmount", + "Tint.Color" + }); + var effectBrush = effectFactory.CreateBrush(); + effectBrush.SetSourceParameter("backdrop", backdrop); + CompositionBrush = effectBrush; +#else CompositionBrush = Window.Current.Compositor.CreateColorBrush(Colors.Black); +#endif } } diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControl.xaml b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControl.xaml index c22c04b..2927f55 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControl.xaml +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControl.xaml @@ -45,14 +45,13 @@ - - + diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControlVM.cs b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControlVM.cs index c363f4a..34e69dc 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControlVM.cs +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay/UIControls/Settings/TileSettingsControlVM.cs @@ -8,6 +8,13 @@ namespace SmartDisplay.Controls public class TileSettingsControlVM : SmartDisplaySettingsBaseViewModel { private string InvalidNumericalValueErrorText { get; } = Common.GetLocalizedText("InvalidNumericalValueErrorText"); + +#if _M_ARM64 + // Color picker throws exception on ARM64 + public bool LoadColorPicker = false; +#else + public bool LoadColorPicker = true; +#endif public Color TileColor { From 7536ffe4fb352bd54c39544e9cc452592c6de329 Mon Sep 17 00:00:00 2001 From: Jonathan Chiu Date: Tue, 10 Sep 2019 12:58:14 -0700 Subject: [PATCH 4/4] Add exception handling in MNIST page --- .../WinML/Views/MnistPage.xaml.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/WinML/Views/MnistPage.xaml.cs b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/WinML/Views/MnistPage.xaml.cs index b2be81e..80d4c72 100644 --- a/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/WinML/Views/MnistPage.xaml.cs +++ b/Samples/IoTCoreDefaultApp/CS/SmartDisplay.Features/WinML/Views/MnistPage.xaml.cs @@ -2,6 +2,7 @@ using SmartDisplay.Controls; using SmartDisplay.ViewModels; +using System; using Windows.Foundation; using Windows.Media; using Windows.UI; @@ -54,7 +55,14 @@ namespace SmartDisplay.Features.WinML.Views private async void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args) { - InputReady?.Invoke(this, await MnistHelper.GetHandWrittenImageAsync(inkGrid)); + try + { + InputReady?.Invoke(this, await MnistHelper.GetHandWrittenImageAsync(inkGrid)); + } + catch (Exception ex) + { + PageService?.ShowNotification(ex.Message); + } } public void Reset()