From 6a4baa2c765ea49f1576114da4c597dff74c5e66 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Wed, 24 Feb 2021 11:33:45 -0500 Subject: [PATCH 1/4] Add space before comment --- Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs b/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs index ea377e62513..2b9c6b71a4c 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs @@ -16,6 +16,7 @@ using System.Text.Json.Serialization; using System.Text.RegularExpressions; using System.Threading.Tasks; + // TODO Reintroduce graph controls // using Microsoft.Toolkit.Graph.Converters; // using Microsoft.Toolkit.Graph.Providers; From dfebacc94668d84e640dcd4a1046c5f25a647a23 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Wed, 24 Feb 2021 11:34:26 -0500 Subject: [PATCH 2/4] Remove unused _isParsing var --- .../CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs index 159b75a5f7d..fb430092def 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs @@ -95,7 +95,6 @@ public sealed partial class CanvasPathGeometryPage : Page private Color _strokeColor; private Color _fillColor; private bool _selectionChanged = false; - private bool _isParsing = false; private CanvasGeometry _errorGeometry; private GeometryStreamReader _reader; @@ -172,9 +171,7 @@ public CanvasPathGeometryPage() private void ParseData() { _data = InputData.Text; - _isParsing = true; RenderCanvas.Invalidate(); - _isParsing = false; } private void OnCanvasDraw(CanvasControl sender, CanvasDrawEventArgs args) From 4405645baf0ae0b53469b1f60a23debae35f2000 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Wed, 24 Feb 2021 11:35:28 -0500 Subject: [PATCH 3/4] Split out multi class file --- .../Microsoft.Toolkit.Uwp.SampleApp.csproj | 2 + .../SamplePages/EnumValuesExtension/Animal.cs | 15 ++++++ .../AnimalToColorConverter.xaml.cs | 32 +++++++++++++ .../EnumValuesExtensionPage.xaml.cs | 46 +------------------ 4 files changed, 51 insertions(+), 44 deletions(-) create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/Animal.cs create mode 100644 Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/AnimalToColorConverter.xaml.cs diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj index f192b2abe8d..32dda221dcb 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj +++ b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj @@ -495,6 +495,8 @@ ColorPickerPage.xaml + + EnumValuesExtensionPage.xaml diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/Animal.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/Animal.cs new file mode 100644 index 00000000000..2cf8d744e6c --- /dev/null +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/Animal.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.Toolkit.Uwp.SampleApp.Enums +{ + public enum Animal + { + Cat, + Dog, + Bunny, + Parrot, + Squirrel + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/AnimalToColorConverter.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/AnimalToColorConverter.xaml.cs new file mode 100644 index 00000000000..0b3cf01b79c --- /dev/null +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/AnimalToColorConverter.xaml.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.Toolkit.Uwp.SampleApp.Enums; +using Windows.UI; +using Windows.UI.Xaml.Data; + +namespace Microsoft.Toolkit.Uwp.SampleApp.Converters +{ + public sealed class AnimalToColorConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + return (Animal)value switch + { + Animal.Cat => Colors.Coral, + Animal.Dog => Colors.Gray, + Animal.Bunny => Colors.Green, + Animal.Parrot => Colors.YellowGreen, + Animal.Squirrel => Colors.SaddleBrown, + _ => throw new ArgumentException("Invalid value", nameof(value)) + }; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs index 0538c6323c6..664f586066f 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs @@ -2,11 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using Microsoft.Toolkit.Uwp.SampleApp.Enums; -using Windows.UI; +using Microsoft.Toolkit.Uwp.UI; using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages { @@ -27,43 +24,4 @@ public void OnXamlRendered(FrameworkElement control) { } } -} - -#pragma warning disable SA1403 // File may only contain a single namespace -namespace Microsoft.Toolkit.Uwp.SampleApp.Enums -{ - public enum Animal - { - Cat, - Dog, - Bunny, - Parrot, - Squirrel - } -} - -namespace Microsoft.Toolkit.Uwp.SampleApp.Converters -{ - public sealed class AnimalToColorConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - return (Animal)value switch - { - Animal.Cat => Colors.Coral, - Animal.Dog => Colors.Gray, - Animal.Bunny => Colors.Green, - Animal.Parrot => Colors.YellowGreen, - Animal.Squirrel => Colors.SaddleBrown, - _ => throw new ArgumentException("Invalid value", nameof(value)) - }; - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - throw new NotImplementedException(); - } - } -} - -#pragma warning restore SA1403 +} \ No newline at end of file From 121746658d4ed9caea029e48895472eef27b49b0 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Fri, 26 Feb 2021 11:13:25 -0500 Subject: [PATCH 4/4] Made fuctions synchronous that were no longer using await --- .../SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs index a6a531c82e0..d851046a2ab 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs @@ -67,7 +67,7 @@ private void ClearLogsButton_Click(object sender, RoutedEventArgs e) _logs.Clear(); } - private async void EffectElementHost_EnteredViewport(object sender, EventArgs e) + private void EffectElementHost_EnteredViewport(object sender, EventArgs e) { AddLog("Entered viewport"); @@ -81,7 +81,7 @@ private void EffectElementHost_EnteringViewport(object sender, EventArgs e) _effectElement.Source = new BitmapImage(new Uri("ms-appx:///Assets/ToolkitLogo.png")); } - private async void EffectElementHost_ExitedViewport(object sender, EventArgs e) + private void EffectElementHost_ExitedViewport(object sender, EventArgs e) { AddLog("Exited viewport");