From 7b767df0b5a0ba66efa382ea56598f9cf0263cf2 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Thu, 6 Aug 2020 11:16:25 -0700 Subject: [PATCH] getting stylecop undercontrol for UI warnings (#5630) --- .../ModuleEnabledToForegroundConverter.cs | 7 ++- .../Interop.cs | 1 + .../ViewModels/ColorPickerViewModel.cs | 3 -- .../ViewModels/Commands/ButtonClickCommand.cs | 4 +- .../ViewModels/FancyZonesViewModel.cs | 43 +++++++++--------- .../ViewModels/GeneralViewModel.cs | 45 ++++++++----------- .../ViewModels/ImageResizerViewModel.cs | 21 ++++----- .../ViewModels/KeyboardManagerViewModel.cs | 1 - .../ViewModels/PowerPreviewViewModel.cs | 6 +-- .../ViewModels/ShortcutGuideViewModel.cs | 6 +-- .../Views/FancyZonesPage.xaml.cs | 15 +------ .../Views/GeneralPage.xaml.cs | 13 ++---- .../Views/PowerLauncherPage.xaml.cs | 1 - .../Views/PowerPreviewPage.xaml.cs | 12 ++--- .../Views/PowerRenamePage.xaml.cs | 7 +-- .../Views/VisibleIfNotEmpty.cs | 4 -- 16 files changed, 70 insertions(+), 119 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs b/src/core/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs index 3b6f94326f..bc0558c153 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs @@ -1,6 +1,9 @@ -using Microsoft.PowerToys.Settings.UI.Lib; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; -using Windows.UI; +using Microsoft.PowerToys.Settings.UI.Lib; using Windows.UI.Xaml; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Media; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Interop.cs b/src/core/Microsoft.PowerToys.Settings.UI/Interop.cs index ff44c8cfb5..f56e74f457 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Interop.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Interop.cs @@ -26,6 +26,7 @@ namespace Microsoft.PowerToys.Settings.UI [DllImport("user32.dll")] public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow); + [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop naming consistancy")] public const int SW_HIDE = 0; } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ColorPickerViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ColorPickerViewModel.cs index fff0233d0a..7831504d82 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ColorPickerViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ColorPickerViewModel.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.Linq; using System.Text.Json; using Microsoft.PowerToys.Settings.UI.Helpers; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Commands/ButtonClickCommand.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Commands/ButtonClickCommand.cs index 89c05a5dd1..8285a66c5a 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Commands/ButtonClickCommand.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Commands/ButtonClickCommand.cs @@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Commands public ButtonClickCommand(Action execute) { - this._execute = execute; + _execute = execute; } // Occurs when changes occur that affect whether or not the command should execute. @@ -30,5 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Commands { _execute(); } + + public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs index a4fb7a3718..0a167e24f4 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -2,16 +2,13 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Runtime.CompilerServices; -using System.Windows.Input; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.ViewModels.Commands; using Microsoft.PowerToys.Settings.UI.Views; using Microsoft.Toolkit.Uwp.Helpers; using Windows.UI; -using Windows.UI.Popups; namespace Microsoft.PowerToys.Settings.UI.ViewModels { @@ -35,32 +32,32 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName); } - this.LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor); + LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor); - this._shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value; - this._mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value; - this._overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value; - this._moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value; - this._displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value; - this._zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value; - this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; - this._openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value; - this._restoreSize = Settings.Properties.FancyzonesRestoreSize.Value; - this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; - this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; - this._makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value; - this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value; - this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value; - this.EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value; + _shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value; + _mouseSwitch = Settings.Properties.FancyzonesMouseSwitch.Value; + _overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value; + _moveWindowsAcrossMonitors = Settings.Properties.FancyzonesMoveWindowsAcrossMonitors.Value; + _displayChangemoveWindows = Settings.Properties.FancyzonesDisplayChangeMoveWindows.Value; + _zoneSetChangeMoveWindows = Settings.Properties.FancyzonesZoneSetChangeMoveWindows.Value; + _appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value; + _openWindowOnActiveMonitor = Settings.Properties.FancyzonesOpenWindowOnActiveMonitor.Value; + _restoreSize = Settings.Properties.FancyzonesRestoreSize.Value; + _useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value; + _showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value; + _makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value; + _highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value; + _excludedApps = Settings.Properties.FancyzonesExcludedApps.Value; + EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value; string inactiveColor = Settings.Properties.FancyzonesInActiveColor.Value; - this._zoneInActiveColor = inactiveColor != string.Empty ? inactiveColor.ToColor() : "#F5FCFF".ToColor(); + _zoneInActiveColor = inactiveColor != string.Empty ? inactiveColor.ToColor() : "#F5FCFF".ToColor(); string borderColor = Settings.Properties.FancyzonesBorderColor.Value; - this._zoneBorderColor = borderColor != string.Empty ? borderColor.ToColor() : "#FFFFFF".ToColor(); + _zoneBorderColor = borderColor != string.Empty ? borderColor.ToColor() : "#FFFFFF".ToColor(); string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value; - this._zoneHighlightColor = highlightColor != string.Empty ? highlightColor.ToColor() : "#0078D7".ToColor(); + _zoneHighlightColor = highlightColor != string.Empty ? highlightColor.ToColor() : "#0078D7".ToColor(); GeneralSettings generalSettings; try @@ -73,7 +70,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } - this._isEnabled = generalSettings.Enabled.FancyZones; + _isEnabled = generalSettings.Enabled.FancyZones; } private bool _isEnabled; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/GeneralViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/GeneralViewModel.cs index f63c341e2d..4c71e583ac 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/GeneralViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/GeneralViewModel.cs @@ -5,16 +5,12 @@ using System; using System.Diagnostics; using System.Runtime.CompilerServices; -using System.Text.Json; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.Lib.Utilities; using Microsoft.PowerToys.Settings.UI.ViewModels.Commands; using Microsoft.PowerToys.Settings.UI.Views; using Windows.ApplicationModel.Resources; -using Windows.Data.Html; -using Windows.System; -using Windows.UI.Popups; using Windows.UI.Xaml; namespace Microsoft.PowerToys.Settings.UI.ViewModels @@ -29,13 +25,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private ResourceLoader loader = ResourceLoader.GetForViewIndependentUse(); - public readonly string RunningAsUserDefaultText; - public readonly string RunningAsAdminDefaultText; + public string RunningAsUserDefaultText { get; private set; } + + public string RunningAsAdminDefaultText { get; private set; } + + private bool _packaged = false; + private bool _startup = false; + private bool _isElevated = false; + private bool _runElevated = false; + private bool _isAdmin = false; + private bool _isDarkThemeRadioButtonChecked = false; + private bool _isLightThemeRadioButtonChecked = false; + private bool _isSystemThemeRadioButtonChecked = false; + private bool _autoDownloadUpdates = false; public GeneralViewModel() { - this.CheckFoUpdatesEventHandler = new ButtonClickCommand(CheckForUpdates_Click); - this.RestartElevatedButtonEventHandler = new ButtonClickCommand(Restart_Elevated); + CheckFoUpdatesEventHandler = new ButtonClickCommand(CheckForUpdates_Click); + RestartElevatedButtonEventHandler = new ButtonClickCommand(Restart_Elevated); try { @@ -107,16 +114,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _isAdmin = ShellPage.IsUserAnAdmin; } - private bool _packaged = false; - private bool _startup = false; - private bool _isElevated = false; - private bool _runElevated = false; - private bool _isAdmin = false; - private bool _isDarkThemeRadioButtonChecked = false; - private bool _isLightThemeRadioButtonChecked = false; - private bool _isSystemThemeRadioButtonChecked = false; - private bool _autoDownloadUpdates = false; - // Gets or sets a value indicating whether packaged. public bool Packaged { @@ -350,7 +347,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } // callback function to launch the URL to check for updates. - private async void CheckForUpdates_Click() + private void CheckForUpdates_Click() { GeneralSettings settings = SettingsUtils.GetSettings(string.Empty); settings.CustomActionName = "check_for_updates"; @@ -358,10 +355,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); - if (ShellPage.CheckForUpdatesMsgCallback != null) - { - ShellPage.CheckForUpdatesMsgCallback(customaction.ToString()); - } + ShellPage.CheckForUpdatesMsgCallback?.Invoke(customaction.ToString()); } public void Restart_Elevated() @@ -372,10 +366,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings); GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings); - if (ShellPage.SndRestartAsAdminMsgCallback != null) - { - ShellPage.SndRestartAsAdminMsgCallback(customaction.ToString()); - } + ShellPage.SndRestartAsAdminMsgCallback?.Invoke(customaction.ToString()); } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs index 16153b1e3d..991347015e 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs @@ -2,18 +2,13 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Collections.Specialized; using System.ComponentModel; using System.Linq; -using System.Text.RegularExpressions; using System.Windows.Input; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.Views; -using Windows.UI.Popups; namespace Microsoft.PowerToys.Settings.UI.ViewModels { @@ -47,14 +42,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } - this._isEnabled = generalSettings.Enabled.ImageResizer; - this._advancedSizes = Settings.Properties.ImageresizerSizes.Value; - this._jpegQualityLevel = Settings.Properties.ImageresizerJpegQualityLevel.Value; - this._pngInterlaceOption = Settings.Properties.ImageresizerPngInterlaceOption.Value; - this._tiffCompressOption = Settings.Properties.ImageresizerTiffCompressOption.Value; - this._fileName = Settings.Properties.ImageresizerFileName.Value; - this._keepDateModified = Settings.Properties.ImageresizerKeepDateModified.Value; - this._encoderGuidId = GetEncoderIndex(Settings.Properties.ImageresizerFallbackEncoder.Value); + _isEnabled = generalSettings.Enabled.ImageResizer; + _advancedSizes = Settings.Properties.ImageresizerSizes.Value; + _jpegQualityLevel = Settings.Properties.ImageresizerJpegQualityLevel.Value; + _pngInterlaceOption = Settings.Properties.ImageresizerPngInterlaceOption.Value; + _tiffCompressOption = Settings.Properties.ImageresizerTiffCompressOption.Value; + _fileName = Settings.Properties.ImageresizerFileName.Value; + _keepDateModified = Settings.Properties.ImageresizerKeepDateModified.Value; + _encoderGuidId = GetEncoderIndex(Settings.Properties.ImageresizerFallbackEncoder.Value); int i = 0; foreach (ImageSize size in _advancedSizes) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/KeyboardManagerViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/KeyboardManagerViewModel.cs index 858d11ebe0..5e14cb5714 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/KeyboardManagerViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/KeyboardManagerViewModel.cs @@ -13,7 +13,6 @@ using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.Lib.Utilities; using Microsoft.PowerToys.Settings.UI.Views; -using Microsoft.Toolkit.Uwp.Helpers; using Windows.System; using Windows.UI.Core; using Windows.UI.Xaml; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerPreviewViewModel.cs index 1732660de2..760dcd3af7 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -27,9 +27,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName); } - this._svgRenderIsEnabled = Settings.Properties.EnableSvgPreview; - this._svgThumbnailIsEnabled = Settings.Properties.EnableSvgThumbnail; - this._mdRenderIsEnabled = Settings.Properties.EnableMdPreview; + _svgRenderIsEnabled = Settings.Properties.EnableSvgPreview; + _svgThumbnailIsEnabled = Settings.Properties.EnableSvgThumbnail; + _mdRenderIsEnabled = Settings.Properties.EnableMdPreview; } private bool _svgRenderIsEnabled = false; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs index 36bef415e0..cc61c3748d 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs @@ -39,9 +39,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty); } - this._isEnabled = generalSettings.Enabled.ShortcutGuide; - this._pressTime = Settings.Properties.PressTime.Value; - this._opacity = Settings.Properties.OverlayOpacity.Value; + _isEnabled = generalSettings.Enabled.ShortcutGuide; + _pressTime = Settings.Properties.PressTime.Value; + _opacity = Settings.Properties.OverlayOpacity.Value; string theme = Settings.Properties.Theme.Value; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml.cs index 1aa5a5fd31..804b6fc4eb 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml.cs @@ -2,21 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using Microsoft.PowerToys.Settings.UI.ViewModels; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; namespace Microsoft.PowerToys.Settings.UI.Views { @@ -26,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public FancyZonesPage() { - this.InitializeComponent(); + InitializeComponent(); ViewModel = new FancyZonesViewModel(); MainView.DataContext = ViewModel; } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs index f8c5d75062..7d7c81e65d 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs @@ -2,15 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.IO; -using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.ViewModels; -using Windows.System; -using Windows.UI.Popups; -using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; namespace Microsoft.PowerToys.Settings.UI.Views { @@ -30,10 +23,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views /// public GeneralPage() { - this.InitializeComponent(); + InitializeComponent(); - this.ViewModel = new GeneralViewModel(); - this.GeneralSettingsView.DataContext = this.ViewModel; + ViewModel = new GeneralViewModel(); + GeneralSettingsView.DataContext = ViewModel; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs index 48c959ff10..0a6acb366b 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; using System.Collections.ObjectModel; -using System.Linq; using Microsoft.PowerToys.Settings.UI.ViewModels; using Windows.UI.Xaml.Controls; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs index cc82d9fa39..3afc48ab64 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs @@ -2,12 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.ViewModels; -using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; namespace Microsoft.PowerToys.Settings.UI.Views { @@ -16,13 +12,13 @@ namespace Microsoft.PowerToys.Settings.UI.Views /// public sealed partial class PowerPreviewPage : Page { - public PowerPreviewViewModel viewModel { get; set; } + public PowerPreviewViewModel ViewModel { get; set; } public PowerPreviewPage() { - this.InitializeComponent(); - viewModel = new PowerPreviewViewModel(); - this.PowerPreviewSettingsView.DataContext = viewModel; + InitializeComponent(); + ViewModel = new PowerPreviewViewModel(); + PowerPreviewSettingsView.DataContext = ViewModel; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs index f81204c066..1cd17031df 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs @@ -2,13 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.ViewModels; -using Microsoft.UI.Xaml.Controls; -using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; namespace Microsoft.PowerToys.Settings.UI.Views { @@ -18,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public PowerRenamePage() { - this.InitializeComponent(); + InitializeComponent(); ViewModel = new PowerRenameViewModel(); DataContext = ViewModel; diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/VisibleIfNotEmpty.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/VisibleIfNotEmpty.cs index 14df92e803..17e6bc9764 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/VisibleIfNotEmpty.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/VisibleIfNotEmpty.cs @@ -4,10 +4,6 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Windows.UI.Xaml; using Windows.UI.Xaml.Data;