diff --git a/.editorconfig b/.editorconfig index 9225e97f11a..a9aa56e83ff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -236,3 +236,87 @@ dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style dotnet_naming_style.prefix_private_field_with_underscore.capitalization = camel_case dotnet_naming_style.prefix_private_field_with_underscore.required_prefix = _ +# Code files +[*.{cs,vb}] + +# Migrate back from old Toolkit.ruleset +dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1009.severity = warning +dotnet_diagnostic.CA1016.severity = warning +dotnet_diagnostic.CA1033.severity = warning +dotnet_diagnostic.CA1049.severity = warning +dotnet_diagnostic.CA1060.severity = warning +dotnet_diagnostic.CA1061.severity = warning +dotnet_diagnostic.CA1063.severity = warning +dotnet_diagnostic.CA1065.severity = warning +dotnet_diagnostic.CA1301.severity = warning +dotnet_diagnostic.CA1400.severity = warning +dotnet_diagnostic.CA1401.severity = warning +dotnet_diagnostic.CA1403.severity = warning +dotnet_diagnostic.CA1404.severity = warning +dotnet_diagnostic.CA1405.severity = warning +dotnet_diagnostic.CA1410.severity = warning +dotnet_diagnostic.CA1415.severity = warning +dotnet_diagnostic.CA1821.severity = warning +dotnet_diagnostic.CA1900.severity = warning +dotnet_diagnostic.CA1901.severity = warning +dotnet_diagnostic.CA2002.severity = warning +dotnet_diagnostic.CA2100.severity = warning +dotnet_diagnostic.CA2101.severity = warning +dotnet_diagnostic.CA2108.severity = warning +dotnet_diagnostic.CA2111.severity = warning +dotnet_diagnostic.CA2112.severity = warning +dotnet_diagnostic.CA2114.severity = warning +dotnet_diagnostic.CA2116.severity = warning +dotnet_diagnostic.CA2117.severity = warning +dotnet_diagnostic.CA2122.severity = warning +dotnet_diagnostic.CA2123.severity = warning +dotnet_diagnostic.CA2124.severity = warning +dotnet_diagnostic.CA2126.severity = warning +dotnet_diagnostic.CA2131.severity = warning +dotnet_diagnostic.CA2132.severity = warning +dotnet_diagnostic.CA2133.severity = warning +dotnet_diagnostic.CA2134.severity = warning +dotnet_diagnostic.CA2137.severity = warning +dotnet_diagnostic.CA2138.severity = warning +dotnet_diagnostic.CA2140.severity = warning +dotnet_diagnostic.CA2141.severity = warning +dotnet_diagnostic.CA2146.severity = warning +dotnet_diagnostic.CA2147.severity = warning +dotnet_diagnostic.CA2149.severity = warning +dotnet_diagnostic.CA2200.severity = warning +dotnet_diagnostic.CA2202.severity = warning +dotnet_diagnostic.CA2207.severity = warning +dotnet_diagnostic.CA2212.severity = warning +dotnet_diagnostic.CA2213.severity = warning +dotnet_diagnostic.CA2214.severity = warning +dotnet_diagnostic.CA2216.severity = warning +dotnet_diagnostic.CA2220.severity = warning +dotnet_diagnostic.CA2229.severity = warning +dotnet_diagnostic.CA2231.severity = warning +dotnet_diagnostic.CA2232.severity = warning +dotnet_diagnostic.CA2235.severity = warning +dotnet_diagnostic.CA2236.severity = warning +dotnet_diagnostic.CA2237.severity = warning +dotnet_diagnostic.CA2238.severity = warning +dotnet_diagnostic.CA2240.severity = warning +dotnet_diagnostic.CA2241.severity = warning +dotnet_diagnostic.CA2242.severity = warning +dotnet_diagnostic.SA1011.severity = none +dotnet_diagnostic.SA1101.severity = none +dotnet_diagnostic.SA1118.severity = none +dotnet_diagnostic.SA1200.severity = none +dotnet_diagnostic.SA1201.severity = none +dotnet_diagnostic.SA1202.severity = none +dotnet_diagnostic.SA1309.severity = none +dotnet_diagnostic.SA1310.severity = none +dotnet_diagnostic.SA1600.severity = none +dotnet_diagnostic.SA1602.severity = none +dotnet_diagnostic.SA1611.severity = none +dotnet_diagnostic.SA1633.severity = none +dotnet_diagnostic.SA1634.severity = none +dotnet_diagnostic.SA1652.severity = none + +dotnet_diagnostic.SA1629.severity = none # DocumentationTextMustEndWithAPeriod: Let's enable this rule back when we shift to WinUI3 (v8.x). If we do it now, it would mean more than 400 file changes. +dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializers: This would also mean a lot of changes at the end of all multiline intializers. It's also debatable if we want this or not. +dotnet_diagnostic.SA1314.severity = none # TypeParameterNamesMustBeginWithT: We do have a few templates that don't start with T. We need to double check that changing this is not a breaking change. If not, we can re-enable this. \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 4f6d23454b8..4c837faa9c4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,6 @@ https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/license.md v3.0 release https://github.com/windows-toolkit/WindowsCommunityToolkit/releases (c) .NET Foundation and Contributors. All rights reserved. - $(MSBuildThisFileDirectory)Toolkit.ruleset en-US $(MSBuildProjectName.Contains('.Design')) $(MSBuildProjectName.Contains('Test')) @@ -62,7 +61,7 @@ - + diff --git a/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs b/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs index 73e84a59167..aa45d7c9598 100644 --- a/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs +++ b/Microsoft.Toolkit.Services/Services/LinkedIn/LinkedInDataProvider.cs @@ -176,7 +176,7 @@ public async Task LogoutAsync() if (crendential != null) { _passwordManager.Remove(LinkedInConstants.STORAGEKEYACCESSTOKEN); - await _storageManager.SetAsync(LinkedInConstants.STORAGEKEYUSER, null); + await _storageManager.SetAsync(LinkedInConstants.STORAGEKEYUSER, null); } LoggedIn = false; diff --git a/Microsoft.Toolkit.Services/Services/Weibo/WeiboDataProvider.cs b/Microsoft.Toolkit.Services/Services/Weibo/WeiboDataProvider.cs index 1ab7619ab9f..3dd6d59a8ac 100644 --- a/Microsoft.Toolkit.Services/Services/Weibo/WeiboDataProvider.cs +++ b/Microsoft.Toolkit.Services/Services/Weibo/WeiboDataProvider.cs @@ -185,7 +185,7 @@ public async Task LogoutAsync() if (credential != null) { _passwordManager.Remove(PasswordKey); - await _storageManager.SetAsync(StorageKey, null); + await _storageManager.SetAsync(StorageKey, null); } Uid = null; diff --git a/Microsoft.Toolkit.Uwp.Notifications/Toasts/Builder/ToastContentBuilder.Visuals.cs b/Microsoft.Toolkit.Uwp.Notifications/Toasts/Builder/ToastContentBuilder.Visuals.cs index 654bc921f67..0de3804d214 100644 --- a/Microsoft.Toolkit.Uwp.Notifications/Toasts/Builder/ToastContentBuilder.Visuals.cs +++ b/Microsoft.Toolkit.Uwp.Notifications/Toasts/Builder/ToastContentBuilder.Visuals.cs @@ -82,50 +82,50 @@ private IList VisualChildren #if WINDOWS_UWP - /// - /// Create an instance of NotificationData that can be used to update toast that has a progress bar. - /// - /// Instance of ToastContent that contain progress bars that need to be updated - /// Index of the progress bar (0-based) that this notification data is updating in the case that toast has multiple progress bars. Default to 0. - /// Title of the progress bar. - /// Value of the progress bar. - /// An optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed. - /// A status string, which is displayed underneath the progress bar on the left. Default to empty. - /// A sequence number to prevent out-of-order updates, or assign 0 to indicate "always update". - /// An instance of NotificationData that can be used to update the toast. - public static NotificationData CreateProgressBarData(ToastContent toast, int index = 0, string title = default(string), double? value = null, string valueStringOverride = default(string), string status = default(string), uint sequence = 0) - { - var progressBar = toast.Visual.BindingGeneric.Children.Where(c => c is AdaptiveProgressBar).ElementAt(index) as AdaptiveProgressBar; - if (progressBar == null) - { - throw new ArgumentException(nameof(toast), "Given toast does not have any progress bar"); - } - - NotificationData data = new NotificationData(); - data.SequenceNumber = sequence; - - if (progressBar.Title is BindableString bindableTitle && title != default(string)) - { - data.Values[bindableTitle.BindingName] = title; - } - - if (progressBar.Value is BindableProgressBarValue bindableProgressValue && value != null) - { - data.Values[bindableProgressValue.BindingName] = value.ToString(); - } - - if (progressBar.ValueStringOverride is BindableString bindableValueStringOverride && valueStringOverride != default(string)) - { - data.Values[bindableValueStringOverride.BindingName] = valueStringOverride; - } - - if (progressBar.Status is BindableString bindableStatus && status != default(string)) - { - data.Values[bindableStatus.BindingName] = status; - } - - return data; - } + /// + /// Create an instance of NotificationData that can be used to update toast that has a progress bar. + /// + /// Instance of ToastContent that contain progress bars that need to be updated + /// Index of the progress bar (0-based) that this notification data is updating in the case that toast has multiple progress bars. Default to 0. + /// Title of the progress bar. + /// Value of the progress bar. + /// An optional string to be displayed instead of the default percentage string. If this isn't provided, something like "70%" will be displayed. + /// A status string, which is displayed underneath the progress bar on the left. Default to empty. + /// A sequence number to prevent out-of-order updates, or assign 0 to indicate "always update". + /// An instance of NotificationData that can be used to update the toast. + public static NotificationData CreateProgressBarData(ToastContent toast, int index = 0, string title = default(string), double? value = null, string valueStringOverride = default(string), string status = default(string), uint sequence = 0) + { + var progressBar = toast.Visual.BindingGeneric.Children.Where(c => c is AdaptiveProgressBar).ElementAt(index) as AdaptiveProgressBar; + if (progressBar == null) + { + throw new ArgumentException(nameof(toast), "Given toast does not have any progress bar"); + } + + NotificationData data = new NotificationData(); + data.SequenceNumber = sequence; + + if (progressBar.Title is BindableString bindableTitle && title != default(string)) + { + data.Values[bindableTitle.BindingName] = title; + } + + if (progressBar.Value is BindableProgressBarValue bindableProgressValue && value != null) + { + data.Values[bindableProgressValue.BindingName] = value.ToString(); + } + + if (progressBar.ValueStringOverride is BindableString bindableValueStringOverride && valueStringOverride != default(string)) + { + data.Values[bindableValueStringOverride.BindingName] = valueStringOverride; + } + + if (progressBar.Status is BindableString bindableStatus && status != default(string)) + { + data.Values[bindableStatus.BindingName] = status; + } + + return data; + } #endif diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs index e5dfdcf01b4..a0e5afa756d 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/Connected.cs @@ -412,6 +412,7 @@ private static void OnKeyChanged(DependencyObject d, DependencyPropertyChangedEv { (frame.Content as Page)?.UnregisterElementForConnectedAnimation(oldKey); } + if (e.NewValue is string newKey) { (frame.Content as Page)?.RegisterElementForConnectedAnimation(newKey, element); diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/ConnectedAnimationHelper.cs b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/ConnectedAnimationHelper.cs index 702eacacd4d..31c18fe0ac3 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/ConnectedAnimationHelper.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/ConnectedAnimations/ConnectedAnimationHelper.cs @@ -116,10 +116,10 @@ private void Frame_Navigated(object sender, Windows.UI.Xaml.Navigation.Navigatio return; } - void loadedHandler(object s, RoutedEventArgs args) + void LoadedHandler(object s, RoutedEventArgs args) { var page = s as Page; - page.Loaded -= loadedHandler; + page.Loaded -= LoadedHandler; object parameter; if (_nextParameter != null) @@ -204,7 +204,7 @@ void loadedHandler(object s, RoutedEventArgs args) _nextParameter = null; } - navigatedPage.Loaded += loadedHandler; + navigatedPage.Loaded += LoadedHandler; } private void UseDirectConnectedAnimationConfiguration(ConnectedAnimation animation) diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Extensions/AnimationExtensions.cs b/Microsoft.Toolkit.Uwp.UI.Animations/Extensions/AnimationExtensions.cs index 3a34ebb9248..7d0007ee480 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Extensions/AnimationExtensions.cs +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Extensions/AnimationExtensions.cs @@ -184,7 +184,7 @@ private static CompositionEasingFunction GenerateCompositionEasingFunctionFromEa // Pay-per-play caching of easing functions EnsureEasingsCached(); - if (_compositionEasingFunctions.TryGetValue((easingType.ToString(), easingMode), out(Vector2, Vector2) points)) + if (_compositionEasingFunctions.TryGetValue((easingType.ToString(), easingMode), out (Vector2, Vector2) points)) { return compositor.CreateCubicBezierEasingFunction(points.Item1, points.Item2); } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/CollectionViews/ListCollectionView.cs b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/CollectionViews/ListCollectionView.cs index 5c5ee466d43..9f1370b8576 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/CollectionViews/ListCollectionView.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/CollectionViews/ListCollectionView.cs @@ -90,7 +90,9 @@ protected override void RefreshOverride() if (!UsesLocalArray) { #endif - _internalList = list; +#pragma warning disable SA1137 // Elements should have the same indentation + _internalList = list; +#pragma warning restore SA1137 // Elements should have the same indentation #if FEATURE_ICOLLECTIONVIEW_SORT_OR_FILTER } else @@ -1979,6 +1981,7 @@ private IList PrepareLocalArray(IList list) private void MoveCurrencyOffDeletedElement(int oldCurrentPosition) { int lastPosition = InternalCount - 1; // OK if last is -1 + // if position falls beyond last position, move back to last position int newPosition = (oldCurrentPosition < lastPosition) ? oldCurrentPosition : lastPosition; diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeaderAutomationPeer.cs b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeaderAutomationPeer.cs index 5859436ab7f..6f290c9d569 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeaderAutomationPeer.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridColumnHeaderAutomationPeer.cs @@ -99,19 +99,16 @@ protected override object GetPatternCore(PatternInterface patternInterface) switch (patternInterface) { case PatternInterface.Invoke: - { - // this.OwningHeader.OwningGrid.DataConnection.AllowSort property is ignored because of the DataGrid.Sorting custom sorting capability. - if (this.OwningHeader.OwningGrid.CanUserSortColumns && - this.OwningHeader.OwningColumn.CanUserSort) + // this.OwningHeader.OwningGrid.DataConnection.AllowSort property is ignored because of the DataGrid.Sorting custom sorting capability. + if (this.OwningHeader.OwningGrid.CanUserSortColumns && + this.OwningHeader.OwningColumn.CanUserSort) { return this; } break; - } case PatternInterface.ScrollItem: - { if (this.OwningHeader.OwningGrid.HorizontalScrollBar != null && this.OwningHeader.OwningGrid.HorizontalScrollBar.Maximum > 0) { @@ -119,10 +116,8 @@ protected override object GetPatternCore(PatternInterface patternInterface) } break; - } case PatternInterface.Transform: - { if (this.OwningHeader.OwningColumn != null && this.OwningHeader.OwningColumn.ActualCanUserResize) { @@ -130,7 +125,6 @@ protected override object GetPatternCore(PatternInterface patternInterface) } break; - } } } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridGroupItemAutomationPeer.cs b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridGroupItemAutomationPeer.cs index 3bf9966a638..93de235a0de 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridGroupItemAutomationPeer.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridGroupItemAutomationPeer.cs @@ -174,10 +174,12 @@ protected override IList GetChildrenCore() if (_group.IsBottomLevel) { #endif +#pragma warning disable SA1137 // Elements should have the same indentation foreach (object item in _group.GroupItems /*Items*/) { children.Add(this.OwningDataGridPeer.GetOrCreateItemPeer(item)); } +#pragma warning restore SA1137 // Elements should have the same indentation #if FEATURE_ICOLLECTIONVIEW_GROUP } else diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridComboBoxColumn.cs b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridComboBoxColumn.cs index 67b30c7c90e..9269a1209cf 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridComboBoxColumn.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridComboBoxColumn.cs @@ -218,9 +218,9 @@ protected override FrameworkElement GenerateEditingElement(DataGridCell cell, ob { var value = dataItem.GetType().GetProperty(Binding.Path.Path).GetValue(dataItem); - var selection = !string.IsNullOrEmpty(DisplayMemberPath) - ? ItemsSource?.Cast().FirstOrDefault(x => x.GetType().GetProperty(Binding.Path.Path).GetValue(x).Equals(value)) - : ItemsSource?.Cast().FirstOrDefault(x => x.Equals(value)); + var selection = !string.IsNullOrEmpty(DisplayMemberPath) + ? ItemsSource?.Cast().FirstOrDefault(x => x.GetType().GetProperty(Binding.Path.Path).GetValue(x).Equals(value)) + : ItemsSource?.Cast().FirstOrDefault(x => x.Equals(value)); comboBox.SelectedItem = selection; } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render/MarkdownRenderer.Inlines.cs b/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render/MarkdownRenderer.Inlines.cs index 9c576e731c2..95f0c3e9978 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render/MarkdownRenderer.Inlines.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render/MarkdownRenderer.Inlines.cs @@ -416,6 +416,7 @@ protected override void RenderStrikethroughRun(StrikethroughTextInline element, builder.Append((char)0x0336); builder.Append(c); } + run.Text = builder.ToString(); }); } diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/TextToolbar.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/TextToolbar.Properties.cs index 3c481bcd164..c7f7148d0c1 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/TextToolbar.Properties.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/TextToolbar.Properties.cs @@ -90,7 +90,7 @@ public Formatter Formatter public ButtonMap DefaultButtons { get { return (ButtonMap)GetValue(DefaultButtonsProperty); } - private set { SetValue(DefaultButtonsProperty, value); } + private set { SetValue(DefaultButtonsProperty, value); } } /// diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/ToolbarItems/Common/CommonButtons.Events.cs b/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/ToolbarItems/Common/CommonButtons.Events.cs index 93cacbbc9de..f5251b7cd72 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/ToolbarItems/Common/CommonButtons.Events.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/TextToolbar/ToolbarItems/Common/CommonButtons.Events.cs @@ -84,8 +84,8 @@ public async void OpenLinkCreator(ToolbarButton button) } labelBox.Document.SetDefaultCharacterFormat(selection.CharacterFormat); - selection.GetText(Windows.UI.Text.TextGetOptions.FormatRtf, out string Labeltext); - labelBox.Document.SetText(Windows.UI.Text.TextSetOptions.FormatRtf, Labeltext); + selection.GetText(Windows.UI.Text.TextGetOptions.FormatRtf, out string labeltext); + labelBox.Document.SetText(Windows.UI.Text.TextSetOptions.FormatRtf, labeltext); var result = await new ContentDialog { diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid/UniformGrid.Helpers.cs b/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid/UniformGrid.Helpers.cs index f7cbd247378..7263e513c74 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid/UniformGrid.Helpers.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/UniformGrid/UniformGrid.Helpers.cs @@ -5,11 +5,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -[assembly: InternalsVisibleTo("UnitTests")] namespace Microsoft.Toolkit.Uwp.UI.Controls { /// diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.cs b/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.cs index 8a2a3997fef..db6089481ed 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.cs @@ -208,7 +208,7 @@ protected override Size ArrangeOverride(Size finalSize) var position = new UvMeasure(Orientation, Padding.Left, Padding.Top); double currentV = 0; - void arrange(UIElement child, bool isLast = false) + void Arrange(UIElement child, bool isLast = false) { var desiredMeasure = new UvMeasure(Orientation, child.DesiredSize.Width, child.DesiredSize.Height); if (desiredMeasure.U == 0) @@ -248,10 +248,10 @@ void arrange(UIElement child, bool isLast = false) var lastIndex = Children.Count - 1; for (var i = 0; i < lastIndex; i++) { - arrange(Children[i]); + Arrange(Children[i]); } - arrange(Children[lastIndex], StretchChild == StretchChild.Last); + Arrange(Children[lastIndex], StretchChild == StretchChild.Last); } return finalSize; diff --git a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs index 16d7ac6e166..472951e2879 100644 --- a/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs +++ b/Microsoft.Toolkit.Uwp/Helpers/PrintHelper/PrintHelper.cs @@ -260,6 +260,7 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.Co { _stateBags[element].Restore(element); } + _stateBags.Clear(); _canvasContainer.RequestedTheme = ElementTheme.Default; await DetachCanvas(); @@ -267,20 +268,16 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.Co switch (args.Completion) { case PrintTaskCompletion.Failed: - { OnPrintFailed?.Invoke(); break; - } + case PrintTaskCompletion.Canceled: - { OnPrintCanceled?.Invoke(); break; - } + case PrintTaskCompletion.Submitted: - { OnPrintSucceeded?.Invoke(); break; - } } }); }; diff --git a/Microsoft.Toolkit/Converters.cs b/Microsoft.Toolkit/Converters.cs index 20cb290b8b0..f92c0e8f08a 100644 --- a/Microsoft.Toolkit/Converters.cs +++ b/Microsoft.Toolkit/Converters.cs @@ -22,27 +22,27 @@ public static string ToFileSizeString(long size) } else if ((size >> 10) < 1024) { - return (size / (float)1024).ToString("F1") + " KB"; + return (size / 1024F).ToString("F1") + " KB"; } else if ((size >> 20) < 1024) { - return ((size >> 10) / (float)1024).ToString("F1") + " MB"; + return ((size >> 10) / 1024F).ToString("F1") + " MB"; } else if ((size >> 30) < 1024) { - return ((size >> 20) / (float)1024).ToString("F1") + " GB"; + return ((size >> 20) / 1024F).ToString("F1") + " GB"; } else if ((size >> 40) < 1024) { - return ((size >> 30) / (float)1024).ToString("F1") + " TB"; + return ((size >> 30) / 1024F).ToString("F1") + " TB"; } else if ((size >> 50) < 1024) { - return ((size >> 40) / (float)1024).ToString("F1") + " PB"; + return ((size >> 40) / 1024F).ToString("F1") + " PB"; } else { - return ((size >> 50) / (float)1024).ToString("F0") + " EB"; + return ((size >> 50) / 1024F).ToString("F0") + " EB"; } } } diff --git a/Toolkit.ruleset b/Toolkit.ruleset deleted file mode 100644 index 5f70b95957e..00000000000 --- a/Toolkit.ruleset +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file