diff --git a/src/codeAnalysis/GlobalSuppressions.cs b/src/codeAnalysis/GlobalSuppressions.cs index 5446e1a88b..b257bd7cc6 100644 --- a/src/codeAnalysis/GlobalSuppressions.cs +++ b/src/codeAnalysis/GlobalSuppressions.cs @@ -1,5 +1,5 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// 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. // This file is used by Code Analysis to maintain SuppressMessage diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs index 5bf7ed851a..2918d83986 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GeneralSettings.cs @@ -34,13 +34,13 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public GeneralSettings() { - this.Packaged = false; - this.startup = false; - this.is_admin = false; - this.is_elevated = false; - this.theme = "system"; - this.system_theme = "light"; - this.powertoys_version = "v0.15.3"; + Packaged = false; + startup = false; + is_admin = false; + is_elevated = false; + theme = "system"; + system_theme = "light"; + powertoys_version = "v0.15.3"; } // converts the current to a json string. diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GlobalSuppressions.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/GlobalSuppressions.cs deleted file mode 100644 index f29087a711..0000000000 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/GlobalSuppressions.cs +++ /dev/null @@ -1,10 +0,0 @@ -// 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. - -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Element should not begin with upper-case letter to keep backward compatibilty with old settings.")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Identifiers should contain underscores to keep backward compatibilty with old settings.")] diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs index 4ef28a82c6..eec2db7d12 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs @@ -24,27 +24,27 @@ namespace Microsoft.PowerToys.Settings.UI.Lib { StringBuilder output = new StringBuilder(); - if (this.win) + if (win) { output.Append("Win + "); } - if (this.ctrl) + if (ctrl) { output.Append("Ctrl + "); } - if (this.alt) + if (alt) { output.Append("Alt + "); } - if (this.shift) + if (shift) { output.Append("Shift + "); } - output.Append(this.key); + output.Append(key); return output.ToString(); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerProperties.cs index 5a4af6495d..adfae0d561 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerProperties.cs @@ -16,8 +16,8 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public KeyboardManagerProperties() { - this.EditShortcut = new BoolProperty(); - this.RemapKeyboard = new BoolProperty(); + EditShortcut = new BoolProperty(); + RemapKeyboard = new BoolProperty(); } public string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerSettings.cs index b35a0c40ac..75f44eb5ab 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/KeyboardManagerSettings.cs @@ -1,25 +1,31 @@ -using System; +// 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.Text; +using System.Text.Json.Serialization; namespace Microsoft.PowerToys.Settings.UI.Lib { public class KeyboardManagerSettings : BasePTModuleSettings { - public KeyboardManagerProperties properties { get; set; } + [JsonPropertyName("properties")] + public KeyboardManagerProperties Properties { get; set; } - public KeyboardManagerSettings() + public KeyboardManagerSettings() { - this.properties = new KeyboardManagerProperties(); - this.version = "1"; - this.name = "_unset_"; + Properties = new KeyboardManagerProperties(); + version = "1"; + name = "_unset_"; } public KeyboardManagerSettings(string ptName) { - this.properties = new KeyboardManagerProperties(); - this.version = "1"; - this.name = ptName; + Properties = new KeyboardManagerProperties(); + version = "1"; + name = ptName; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/Microsoft.PowerToys.Settings.UI.Lib.csproj b/src/core/Microsoft.PowerToys.Settings.UI.Lib/Microsoft.PowerToys.Settings.UI.Lib.csproj index daa75244e3..f876c6964d 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/Microsoft.PowerToys.Settings.UI.Lib.csproj +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/Microsoft.PowerToys.Settings.UI.Lib.csproj @@ -19,6 +19,10 @@ + + + + all diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/OutGoingGeneralSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/OutGoingGeneralSettings.cs index c2259fad8d..4a94d79777 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/OutGoingGeneralSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/OutGoingGeneralSettings.cs @@ -12,12 +12,12 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public OutGoingGeneralSettings() { - this.general = null; + general = null; } public OutGoingGeneralSettings(GeneralSettings generalSettings) { - this.general = generalSettings; + general = generalSettings; } public override string ToString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs index 5dec531a7b..01887c516f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs @@ -28,12 +28,12 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public PowerLauncherProperties() { - this.open_powerlauncher = new HotkeySettings(); - this.open_file_location = new HotkeySettings(); - this.copy_path_location = new HotkeySettings(); - this.open_console = new HotkeySettings(); - this.search_result_preference = "most_recently_used"; - this.search_type_preference = "application_name"; + open_powerlauncher = new HotkeySettings(); + open_file_location = new HotkeySettings(); + copy_path_location = new HotkeySettings(); + open_console = new HotkeySettings(); + search_result_preference = "most_recently_used"; + search_type_preference = "application_name"; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs index e841ee93ee..b41061bde9 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs @@ -10,9 +10,9 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public PowerLauncherSettings() { - this.properties = new PowerLauncherProperties(); - this.version = "1"; - this.name = "_unset_"; + properties = new PowerLauncherProperties(); + version = "1"; + name = "_unset_"; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs index 382b0f76f1..34e3797f48 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs @@ -18,8 +18,8 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public PowerPreviewProperties() { - this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new BoolProperty(); - this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new BoolProperty(); + IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new BoolProperty(); + PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new BoolProperty(); } public override string ToString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs index 3eea74ec82..e36d9a8054 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewSettings.cs @@ -16,16 +16,16 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public PowerPreviewSettings() { - this.properties = new PowerPreviewProperties(); - this.version = "1"; - this.name = "_unset_"; + properties = new PowerPreviewProperties(); + version = "1"; + name = "_unset_"; } public PowerPreviewSettings(string ptName) { - this.properties = new PowerPreviewProperties(); - this.version = "1"; - this.name = ptName; + properties = new PowerPreviewProperties(); + version = "1"; + name = ptName; } public override string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs index b7d7a60ff7..3f502b02d1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs @@ -2,31 +2,34 @@ // 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.Text.Json; using System.Text.Json.Serialization; namespace Microsoft.PowerToys.Settings.UI.Lib { - public class PowerRenameProperties { public PowerRenameProperties() { - this.bool_persist_input = new BoolProperty(); - this.bool_mru_enabled = new BoolProperty(); - this.int_max_mru_size = new IntProperty(); - this.bool_show_icon_on_menu = new BoolProperty(); - this.bool_show_extended_menu = new BoolProperty(); + PersistInput = new BoolProperty(); + MruEnabled = new BoolProperty(); + MaxMruSize = new IntProperty(); + ShowIconInMenu = new BoolProperty(); + ShowExtendedMenu = new BoolProperty(); } - public BoolProperty bool_persist_input { get; set; } + [JsonPropertyName("bool_persist_input")] + public BoolProperty PersistInput { get; set; } - public BoolProperty bool_mru_enabled { get; set; } + [JsonPropertyName("bool_mru_enabled")] + public BoolProperty MruEnabled { get; set; } - public IntProperty int_max_mru_size { get; set; } + [JsonPropertyName("int_max_mru_size")] + public IntProperty MaxMruSize { get; set; } - public BoolProperty bool_show_icon_on_menu { get; set; } + [JsonPropertyName("bool_show_icon_on_menu")] + public BoolProperty ShowIconInMenu { get; set; } - public BoolProperty bool_show_extended_menu { get; set; } + [JsonPropertyName("bool_show_extended_menu")] + public BoolProperty ShowExtendedMenu { get; set; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs index 43bd334cae..ca18535027 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs @@ -13,16 +13,16 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public PowerRenameSettings() { - this.properties = new PowerRenameProperties(); - this.version = "1"; - this.name = "_unset_"; + properties = new PowerRenameProperties(); + version = "1"; + name = "_unset_"; } public PowerRenameSettings(string ptName) { - this.properties = new PowerRenameProperties(); - this.version = "1"; - this.name = ptName; + properties = new PowerRenameProperties(); + version = "1"; + name = ptName; } public override string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs index bddf7024db..2ed273cae5 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs @@ -40,7 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public static bool SettingsExists(string powertoy) { - return File.Exists(SettingsUtils.GetSettingsPath(powertoy)); + return File.Exists(GetSettingsPath(powertoy)); } /// @@ -49,7 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib /// Deserialized json settings object. public static T GetSettings(string powertoy) { - var jsonSettingsString = System.IO.File.ReadAllText(SettingsUtils.GetSettingsPath(powertoy)); + var jsonSettingsString = File.ReadAllText(GetSettingsPath(powertoy)); return JsonSerializer.Deserialize(jsonSettingsString); } @@ -63,9 +63,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib CreateSettingsFolder(powertoy); } - System.IO.File.WriteAllText( - SettingsUtils.GetSettingsPath(powertoy), - jsonSettings); + File.WriteAllText(GetSettingsPath(powertoy), jsonSettings); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndKeyboardManagerSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndKeyboardManagerSettings.cs index 2f116384f6..eb0f296825 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndKeyboardManagerSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndKeyboardManagerSettings.cs @@ -10,11 +10,11 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public class SndKeyboardManagerSettings { [JsonPropertyName("Keyboard Manager")] - public KeyboardManagerSettings keyboardManagerSettings { get; } + public KeyboardManagerSettings KeyboardManagerSettings { get; } public SndKeyboardManagerSettings(KeyboardManagerSettings keyboardManagerSettings) { - this.keyboardManagerSettings = keyboardManagerSettings; + KeyboardManagerSettings = keyboardManagerSettings; } public string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs index 440208e30b..14b6fbe00c 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndModuleSettings.cs @@ -15,7 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public SndModuleSettings(T settings) { - this.powertoys = settings; + powertoys = settings; } public string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs index c712df3345..dcd4661c4b 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs @@ -17,7 +17,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public SndPowerPreviewSettings(PowerPreviewSettings settings) { - this.File_Explorer_Preview = settings; + File_Explorer_Preview = settings; } public string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs index f3499c855f..75ffd5b4a1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs @@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public SndPowerRenameSettings(PowerRenameSettings settings) { - this.PowerRename = settings; + PowerRename = settings; } public string ToJsonString() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/App.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI.Runner/App.xaml.cs index 94e236231d..ed44bcfbab 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/App.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/App.xaml.cs @@ -1,15 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; +// 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.Windows; namespace Microsoft.PowerToys.Settings.UI.Runner { /// - /// Interaction logic for App.xaml + /// Interaction logic for App.xaml. /// public partial class App : Application { diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/AssemblyInfo.cs b/src/core/Microsoft.PowerToys.Settings.UI.Runner/AssemblyInfo.cs index 8b5504ecfb..92c2fbe194 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/AssemblyInfo.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/AssemblyInfo.cs @@ -1,10 +1,7 @@ +// 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.Windows; -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs index 0e0953d83e..d079b5d3d5 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/MainWindow.xaml.cs @@ -33,4 +33,4 @@ namespace Microsoft.PowerToys.Settings.UI.Runner } } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj index c0e82803f4..ae438eae2c 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj +++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Microsoft.PowerToys.Settings.UI.Runner.csproj @@ -50,6 +50,10 @@ + + + + True @@ -70,4 +74,8 @@ + + + + \ No newline at end of file diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Program.cs b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Program.cs index 02d3f2cb98..f7517c7f3a 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Runner/Program.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Runner/Program.cs @@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner // Create an instance of the IPC wrapper. private static ITwoWayIPCManager ipcmanager = new TwoWayIPCManager(); - [STAThreadAttribute()] + [STAThread] public static void Main(string[] args) { using (new UI.App()) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Activation/ActivationHandler.cs b/src/core/Microsoft.PowerToys.Settings.UI/Activation/ActivationHandler.cs index 36943745cd..fe71a7ca37 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Activation/ActivationHandler.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Activation/ActivationHandler.cs @@ -1,4 +1,7 @@ -using System; +// 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.Threading.Tasks; namespace Microsoft.PowerToys.Settings.UI.Activation @@ -12,19 +15,19 @@ namespace Microsoft.PowerToys.Settings.UI.Activation public abstract Task HandleAsync(object args); } - // Extend this class to implement new ActivationHandlers + [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "abstract T and abstract")] internal abstract class ActivationHandler : ActivationHandler where T : class { public override async Task HandleAsync(object args) { - await this.HandleInternalAsync(args as T); + await HandleInternalAsync(args as T); } public override bool CanHandle(object args) { // CanHandle checks the args is of type you have configured - return args is T && this.CanHandleInternal(args as T); + return args is T && CanHandleInternal(args as T); } // Override this method to add the activation logic in your activation handler diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Activation/DefaultActivationHandler.cs b/src/core/Microsoft.PowerToys.Settings.UI/Activation/DefaultActivationHandler.cs index af91a338f5..5be096f9fc 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Activation/DefaultActivationHandler.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Activation/DefaultActivationHandler.cs @@ -28,14 +28,14 @@ namespace Microsoft.PowerToys.Settings.UI.Activation arguments = launchArgs.Arguments; } - NavigationService.Navigate(this.navElement, arguments); + NavigationService.Navigate(navElement, arguments); await Task.CompletedTask; } protected override bool CanHandleInternal(IActivatedEventArgs args) { // None of the ActivationHandlers has handled the app activation - return NavigationService.Frame.Content == null && this.navElement != null; + return NavigationService.Frame.Content == null && navElement != null; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/App.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/App.xaml.cs index c428d39887..1e164841ce 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/App.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/App.xaml.cs @@ -1,4 +1,8 @@ -using Microsoft.Toolkit.Win32.UI.XamlHost; +// 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 Microsoft.Toolkit.Win32.UI.XamlHost; namespace Microsoft.PowerToys.Settings.UI { diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs b/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs index 72cb5250fa..314c238e74 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs @@ -1,4 +1,8 @@ -using Microsoft.PowerToys.Settings.UI.Services; +// 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 Microsoft.PowerToys.Settings.UI.Services; using Microsoft.Xaml.Interactivity; using Windows.UI.Xaml; @@ -18,8 +22,8 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors public object DefaultHeader { - get { return this.GetValue(DefaultHeaderProperty); } - set { this.SetValue(DefaultHeaderProperty, value); } + get { return GetValue(DefaultHeaderProperty); } + set { SetValue(DefaultHeaderProperty, value); } } public static readonly DependencyProperty DefaultHeaderProperty = DependencyProperty.Register("DefaultHeader", typeof(object), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(null, (d, e) => current.UpdateHeader())); @@ -67,13 +71,13 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors { base.OnAttached(); current = this; - NavigationService.Navigated += this.OnNavigated; + NavigationService.Navigated += OnNavigated; } protected override void OnDetaching() { base.OnDetaching(); - NavigationService.Navigated -= this.OnNavigated; + NavigationService.Navigated -= OnNavigated; } private void OnNavigated(object sender, NavigationEventArgs e) @@ -81,42 +85,42 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors var frame = sender as Frame; if (frame.Content is Page page) { - this.currentPage = page; + currentPage = page; - this.UpdateHeader(); - this.UpdateHeaderTemplate(); + UpdateHeader(); + UpdateHeaderTemplate(); } } private void UpdateHeader() { - if (this.currentPage != null) + if (currentPage != null) { - var headerMode = GetHeaderMode(this.currentPage); + var headerMode = GetHeaderMode(currentPage); if (headerMode == NavigationViewHeaderMode.Never) { - this.AssociatedObject.Header = null; - this.AssociatedObject.AlwaysShowHeader = false; + AssociatedObject.Header = null; + AssociatedObject.AlwaysShowHeader = false; } else { - var headerFromPage = GetHeaderContext(this.currentPage); + var headerFromPage = GetHeaderContext(currentPage); if (headerFromPage != null) { - this.AssociatedObject.Header = headerFromPage; + AssociatedObject.Header = headerFromPage; } else { - this.AssociatedObject.Header = this.DefaultHeader; + AssociatedObject.Header = DefaultHeader; } if (headerMode == NavigationViewHeaderMode.Always) { - this.AssociatedObject.AlwaysShowHeader = true; + AssociatedObject.AlwaysShowHeader = true; } else { - this.AssociatedObject.AlwaysShowHeader = false; + AssociatedObject.AlwaysShowHeader = false; } } } @@ -124,10 +128,10 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors private void UpdateHeaderTemplate() { - if (this.currentPage != null) + if (currentPage != null) { - var headerTemplate = GetHeaderTemplate(this.currentPage); - this.AssociatedObject.HeaderTemplate = headerTemplate ?? this.DefaultHeaderTemplate; + var headerTemplate = GetHeaderTemplate(currentPage); + AssociatedObject.HeaderTemplate = headerTemplate ?? DefaultHeaderTemplate; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderMode.cs b/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderMode.cs index 3740f8a682..7a9dbb13fb 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderMode.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Behaviors/NavigationViewHeaderMode.cs @@ -1,4 +1,8 @@ -namespace Microsoft.PowerToys.Settings.UI.Behaviors +// 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. + +namespace Microsoft.PowerToys.Settings.UI.Behaviors { public enum NavigationViewHeaderMode { diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs index 5f58228f0e..aba3139c69 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs @@ -28,24 +28,24 @@ namespace Microsoft.PowerToys.Settings.UI.Controls { get { - return this.hotkeySettings; + return hotkeySettings; } set { - if (this.hotkeySettings != value) + if (hotkeySettings != value) { - this.hotkeySettings = value; - this.SetValue(HotkeySettingsProperty, value); - this.HotkeyTextBox.Text = this.HotkeySettings.ToString(); + hotkeySettings = value; + SetValue(HotkeySettingsProperty, value); + HotkeyTextBox.Text = HotkeySettings.ToString(); } } } public HotkeySettingsControl() { - this.InitializeComponent(); - this.HotkeyTextBox.PreviewKeyDown += this.HotkeyTextBox_KeyDown; + InitializeComponent(); + HotkeyTextBox.PreviewKeyDown += HotkeyTextBox_KeyDown; } private static bool IsDown(Windows.System.VirtualKey key) @@ -94,7 +94,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls // TODO: Check that e.OriginalKey is the ScanCode. It is not clear from docs. settings.code = (int)e.OriginalKey; - this.HotkeySettings = settings; + HotkeySettings = settings; } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/GlobalSuppressions.cs b/src/core/Microsoft.PowerToys.Settings.UI/GlobalSuppressions.cs deleted file mode 100644 index 79485d1494..0000000000 --- a/src/core/Microsoft.PowerToys.Settings.UI/GlobalSuppressions.cs +++ /dev/null @@ -1,6 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Classes contain the same name and creating a separate file would result in a new with '1 appended")] diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/Observable.cs b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/Observable.cs index a474f82fe5..d70825aeb8 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/Observable.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/Observable.cs @@ -1,4 +1,7 @@ -using System; +// 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.ComponentModel; using System.Runtime.CompilerServices; @@ -16,9 +19,9 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers } storage = value; - this.OnPropertyChanged(propertyName); + OnPropertyChanged(propertyName); } - protected void OnPropertyChanged(string propertyName) => this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + protected void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/RelayCommand.cs b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/RelayCommand.cs index 8d38b60060..7bfcd8479f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/RelayCommand.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/RelayCommand.cs @@ -1,13 +1,16 @@ -using System; +// 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.Windows.Input; namespace Microsoft.PowerToys.Settings.UI.Helpers { public class RelayCommand : ICommand { - private readonly Action execute; - - private readonly Func canExecute; + private readonly Action _execute; + private readonly Func _canExecute; public event EventHandler CanExecuteChanged; @@ -18,17 +21,18 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers public RelayCommand(Action execute, Func canExecute) { - this.execute = execute ?? throw new ArgumentNullException(nameof(execute)); - this.canExecute = canExecute; + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; } - public bool CanExecute(object parameter) => this.canExecute == null || this.canExecute(); + public bool CanExecute(object parameter) => _canExecute == null || _canExecute(); - public void Execute(object parameter) => this.execute(); + public void Execute(object parameter) => _execute(); - public void OnCanExecuteChanged() => this.CanExecuteChanged?.Invoke(this, EventArgs.Empty); + public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "abstract T and abstract")] public class RelayCommand : ICommand { private readonly Action execute; @@ -48,10 +52,10 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers this.canExecute = canExecute; } - public bool CanExecute(object parameter) => this.canExecute == null || this.canExecute((T)parameter); + public bool CanExecute(object parameter) => canExecute == null || canExecute((T)parameter); - public void Execute(object parameter) => this.execute((T)parameter); + public void Execute(object parameter) => execute((T)parameter); - public void OnCanExecuteChanged() => this.CanExecuteChanged?.Invoke(this, EventArgs.Empty); + public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/ResourceExtensions.cs b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/ResourceExtensions.cs index cda3c1bee6..3f18701ef7 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Helpers/ResourceExtensions.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Helpers/ResourceExtensions.cs @@ -2,9 +2,6 @@ // 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.InteropServices; - using Windows.ApplicationModel.Resources; namespace Microsoft.PowerToys.Settings.UI.Helpers diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj index 380d6c8127..e65ec323f1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj +++ b/src/core/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj @@ -46,6 +46,9 @@ PackageReference + + GlobalSuppressions.cs + @@ -56,7 +59,6 @@ HotkeySettingsControl.xaml - @@ -68,6 +70,7 @@ + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Properties/AssemblyInfo.cs b/src/core/Microsoft.PowerToys.Settings.UI/Properties/AssemblyInfo.cs index fcc06576c0..b3d71b870b 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Properties/AssemblyInfo.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Properties/AssemblyInfo.cs @@ -1,8 +1,11 @@ -using System.Reflection; -using System.Runtime.CompilerServices; +// 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.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Microsoft.PowerToys.Settings.UI")] @@ -17,13 +20,13 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)] \ No newline at end of file +[assembly: ComVisible(false)] diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Services/ActivationService.cs b/src/core/Microsoft.PowerToys.Settings.UI/Services/ActivationService.cs index 762358ce4b..55d7af020c 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Services/ActivationService.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Services/ActivationService.cs @@ -34,33 +34,33 @@ namespace Microsoft.PowerToys.Settings.UI.Services public async Task ActivateAsync(object activationArgs) { - if (this.IsInteractive(activationArgs)) + if (IsInteractive(activationArgs)) { // Initialize services that you need before app activation // take into account that the splash screen is shown while this code runs. - await this.InitializeAsync(); + await InitializeAsync(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (Window.Current.Content == null) { // Create a Shell or Frame to act as the navigation context - Window.Current.Content = this.shell?.Value ?? new Frame(); + Window.Current.Content = shell?.Value ?? new Frame(); } } // Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler // will navigate to the first page - await this.HandleActivationAsync(activationArgs); - this.lastActivationArgs = activationArgs; + await HandleActivationAsync(activationArgs); + lastActivationArgs = activationArgs; - if (this.IsInteractive(activationArgs)) + if (IsInteractive(activationArgs)) { // Ensure the current window is active Window.Current.Activate(); // Tasks after activation - await this.StartupAsync(); + await StartupAsync(); } } @@ -71,7 +71,7 @@ namespace Microsoft.PowerToys.Settings.UI.Services private async Task HandleActivationAsync(object activationArgs) { - var activationHandler = this.GetActivationHandlers() + var activationHandler = GetActivationHandlers() .FirstOrDefault(h => h.CanHandle(activationArgs)); if (activationHandler != null) @@ -79,9 +79,9 @@ namespace Microsoft.PowerToys.Settings.UI.Services await activationHandler.HandleAsync(activationArgs); } - if (this.IsInteractive(activationArgs)) + if (IsInteractive(activationArgs)) { - var defaultHandler = new DefaultActivationHandler(this.defaultNavItem); + var defaultHandler = new DefaultActivationHandler(defaultNavItem); if (defaultHandler.CanHandle(activationArgs)) { await defaultHandler.HandleAsync(activationArgs); diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs index 73cac8d53d..934a0615b8 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs index 0031d3350e..623c348c71 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ImageResizerViewModel.cs @@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Keys.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Keys.cs new file mode 100644 index 0000000000..34610dfd47 --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Keys.cs @@ -0,0 +1,13 @@ +// 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. + +namespace Microsoft.PowerToys.Settings.UI.ViewModels +{ + public class Keys + { + public string From { get; set; } + + public string To { get; set; } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs index 53d7654215..20bae40952 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -19,45 +19,45 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { if (SettingsUtils.SettingsExists(POWERTOYNAME)) { - this.settings = SettingsUtils.GetSettings(POWERTOYNAME); + settings = SettingsUtils.GetSettings(POWERTOYNAME); } else { - this.settings = new PowerLauncherSettings(); + settings = new PowerLauncherSettings(); } } private void UpdateSettings([CallerMemberName] string propertyName = null) { // Notify UI of property change - this.OnPropertyChanged(propertyName); + OnPropertyChanged(propertyName); // Save settings to file var options = new JsonSerializerOptions { WriteIndented = true, }; - SettingsUtils.SaveSettings(JsonSerializer.Serialize(this.settings, options), POWERTOYNAME); + SettingsUtils.SaveSettings(JsonSerializer.Serialize(settings, options), POWERTOYNAME); // Propagate changes to Power Launcher through IPC - var propertiesJson = JsonSerializer.Serialize(this.settings.properties); + var propertiesJson = JsonSerializer.Serialize(settings.properties); ShellPage.DefaultSndMSGCallback( - string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(this.settings.properties))); + string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(settings.properties))); } public bool EnablePowerLauncher { get { - return this.settings.properties.enable_powerlauncher; + return settings.properties.enable_powerlauncher; } set { - if (this.settings.properties.enable_powerlauncher != value) + if (settings.properties.enable_powerlauncher != value) { - this.settings.properties.enable_powerlauncher = value; - this.UpdateSettings(); + settings.properties.enable_powerlauncher = value; + UpdateSettings(); } } } @@ -66,15 +66,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.search_result_preference; + return settings.properties.search_result_preference; } set { - if (this.settings.properties.search_result_preference != value) + if (settings.properties.search_result_preference != value) { - this.settings.properties.search_result_preference = value; - this.UpdateSettings(); + settings.properties.search_result_preference = value; + UpdateSettings(); } } } @@ -83,15 +83,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.search_type_preference; + return settings.properties.search_type_preference; } set { - if (this.settings.properties.search_type_preference != value) + if (settings.properties.search_type_preference != value) { - this.settings.properties.search_type_preference = value; - this.UpdateSettings(); + settings.properties.search_type_preference = value; + UpdateSettings(); } } } @@ -100,15 +100,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.maximum_number_of_results; + return settings.properties.maximum_number_of_results; } set { - if (this.settings.properties.maximum_number_of_results != value) + if (settings.properties.maximum_number_of_results != value) { - this.settings.properties.maximum_number_of_results = value; - this.UpdateSettings(); + settings.properties.maximum_number_of_results = value; + UpdateSettings(); } } } @@ -117,15 +117,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.open_powerlauncher; + return settings.properties.open_powerlauncher; } set { - if (this.settings.properties.open_powerlauncher != value) + if (settings.properties.open_powerlauncher != value) { - this.settings.properties.open_powerlauncher = value; - this.UpdateSettings(); + settings.properties.open_powerlauncher = value; + UpdateSettings(); } } } @@ -134,15 +134,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.open_file_location; + return settings.properties.open_file_location; } set { - if (this.settings.properties.open_file_location != value) + if (settings.properties.open_file_location != value) { - this.settings.properties.open_file_location = value; - this.UpdateSettings(); + settings.properties.open_file_location = value; + UpdateSettings(); } } } @@ -151,15 +151,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.copy_path_location; + return settings.properties.copy_path_location; } set { - if (this.settings.properties.copy_path_location != value) + if (settings.properties.copy_path_location != value) { - this.settings.properties.copy_path_location = value; - this.UpdateSettings(); + settings.properties.copy_path_location = value; + UpdateSettings(); } } } @@ -168,15 +168,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.open_console; + return settings.properties.open_console; } set { - if (this.settings.properties.open_console != value) + if (settings.properties.open_console != value) { - this.settings.properties.open_console = value; - this.UpdateSettings(); + settings.properties.open_console = value; + UpdateSettings(); } } } @@ -185,15 +185,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.override_win_r_key; + return settings.properties.override_win_r_key; } set { - if (this.settings.properties.override_win_r_key != value) + if (settings.properties.override_win_r_key != value) { - this.settings.properties.override_win_r_key = value; - this.UpdateSettings(); + settings.properties.override_win_r_key = value; + UpdateSettings(); } } } @@ -202,15 +202,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { get { - return this.settings.properties.override_win_s_key; + return settings.properties.override_win_s_key; } set { - if (this.settings.properties.override_win_s_key != value) + if (settings.properties.override_win_s_key != value) { - this.settings.properties.override_win_s_key = value; - this.UpdateSettings(); + settings.properties.override_win_s_key = value; + UpdateSettings(); } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerRenameViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerRenameViewModel.cs index 46ab19c88e..dda10c1783 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerRenameViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerRenameViewModel.cs @@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/RemapKeysModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/RemapKeysModel.cs index baf514e842..7c64ca91c9 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/RemapKeysModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/RemapKeysModel.cs @@ -2,30 +2,23 @@ // 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.Collections.ObjectModel; - -namespace Microsoft.PowerToys.Settings.UI.ViewModels -{ - // Dummy data model for the UI. Will be removed moving forward. - public class RemapKeysModel : ObservableCollection - { - public RemapKeysModel() - { - this.Add(new Keys { From = "A", To = "B" }); - this.Add(new Keys { From = "B", To = "A" }); - this.Add(new Keys { From = "Ctrl", To = "Shift" }); - this.Add(new Keys { From = "Shift", To = "Ctrl" }); - this.Add(new Keys { From = "A", To = "B" }); - this.Add(new Keys { From = "B", To = "B" }); - this.Add(new Keys { From = "Ctrl", To = "Shift" }); - this.Add(new Keys { From = "Shift", To = "Ctrl" }); - } - } - - public class Keys - { - public string From { get; set; } - - public string To { get; set; } - } -} +using System.Collections.ObjectModel; + +namespace Microsoft.PowerToys.Settings.UI.ViewModels +{ + // Dummy data model for the UI. Will be removed moving forward. + public class RemapKeysModel : ObservableCollection + { + public RemapKeysModel() + { + Add(new Keys { From = "A", To = "B" }); + Add(new Keys { From = "B", To = "A" }); + Add(new Keys { From = "Ctrl", To = "Shift" }); + Add(new Keys { From = "Shift", To = "Ctrl" }); + Add(new Keys { From = "A", To = "B" }); + Add(new Keys { From = "B", To = "B" }); + Add(new Keys { From = "Ctrl", To = "Shift" }); + Add(new Keys { From = "Shift", To = "Ctrl" }); + } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShellViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShellViewModel.cs index 6efb0ecab5..be4efd8576 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShellViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShellViewModel.cs @@ -32,19 +32,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public bool IsBackEnabled { - get { return this.isBackEnabled; } - set { this.Set(ref this.isBackEnabled, value); } + get { return isBackEnabled; } + set { Set(ref isBackEnabled, value); } } public WinUI.NavigationViewItem Selected { - get { return this.selected; } - set { this.Set(ref this.selected, value); } + get { return selected; } + set { Set(ref selected, value); } } - public ICommand LoadedCommand => this.loadedCommand ?? (this.loadedCommand = new RelayCommand(this.OnLoaded)); + public ICommand LoadedCommand => loadedCommand ?? (loadedCommand = new RelayCommand(OnLoaded)); - public ICommand ItemInvokedCommand => this.itemInvokedCommand ?? (this.itemInvokedCommand = new RelayCommand(this.OnItemInvoked)); + public ICommand ItemInvokedCommand => itemInvokedCommand ?? (itemInvokedCommand = new RelayCommand(OnItemInvoked)); public ShellViewModel() { @@ -55,9 +55,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels this.navigationView = navigationView; this.keyboardAccelerators = keyboardAccelerators; NavigationService.Frame = frame; - NavigationService.NavigationFailed += this.Frame_NavigationFailed; - NavigationService.Navigated += this.Frame_Navigated; - this.navigationView.BackRequested += this.OnBackRequested; + NavigationService.NavigationFailed += Frame_NavigationFailed; + NavigationService.Navigated += Frame_Navigated; + this.navigationView.BackRequested += OnBackRequested; } private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null) @@ -82,14 +82,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { // Keyboard accelerators are added here to avoid showing 'Alt + left' tooltip on the page. // More info on tracking issue https://github.com/Microsoft/microsoft-ui-xaml/issues/8 - this.keyboardAccelerators.Add(this.altLeftKeyboardAccelerator); - this.keyboardAccelerators.Add(this.backKeyboardAccelerator); + keyboardAccelerators.Add(altLeftKeyboardAccelerator); + keyboardAccelerators.Add(backKeyboardAccelerator); await Task.CompletedTask; } private void OnItemInvoked(WinUI.NavigationViewItemInvokedEventArgs args) { - var item = this.navigationView.MenuItems + var item = navigationView.MenuItems .OfType() .First(menuItem => (string)menuItem.Content == (string)args.InvokedItem); var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type; @@ -108,10 +108,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void Frame_Navigated(object sender, NavigationEventArgs e) { - this.IsBackEnabled = NavigationService.CanGoBack; - this.Selected = this.navigationView.MenuItems + IsBackEnabled = NavigationService.CanGoBack; + Selected = navigationView.MenuItems .OfType() - .FirstOrDefault(menuItem => this.IsMenuItemForPageType(menuItem, e.SourcePageType)); + .FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType)); } private bool IsMenuItemForPageType(WinUI.NavigationViewItem menuItem, Type sourcePageType) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs index 8cd4a35b0b..e1298f3598 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/ShortcutGuideViewModel.cs @@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { } } -} \ No newline at end of file +} 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 ff286cead4..28cd12758b 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(); } } } 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 30c8b14dcf..8991c00867 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/GeneralPage.xaml.cs @@ -3,11 +3,9 @@ // 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; @@ -30,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views /// public GeneralPage() { - this.InitializeComponent(); + InitializeComponent(); } /// @@ -44,10 +42,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views settings = SettingsUtils.GetSettings(string.Empty); // load and apply theme settings - this.ReLoadTheme(settings.theme); + ReLoadTheme(settings.theme); // load run on start-up settings value and update the ui state. - this.ToggleSwitch_RunAtStartUp.IsOn = settings.startup; + ToggleSwitch_RunAtStartUp.IsOn = settings.startup; } catch { @@ -56,10 +54,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty); // load and apply theme settings - this.ReLoadTheme(settings.theme); + ReLoadTheme(settings.theme); // load run on start up ui settings value and update the ui state. - this.ToggleSwitch_RunAtStartUp.IsOn = settings.startup; + ToggleSwitch_RunAtStartUp.IsOn = settings.startup; } } @@ -73,15 +71,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views { case "light": ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light; - this.Radio_Theme_Light.IsChecked = true; + Radio_Theme_Light.IsChecked = true; break; case "dark": ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark; - this.Radio_Theme_Dark.IsChecked = true; + Radio_Theme_Dark.IsChecked = true; break; case "system": ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default; - this.Radio_Theme_Default.IsChecked = true; + Radio_Theme_Default.IsChecked = true; break; } } @@ -134,7 +132,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (rb != null) { string themeName = rb.Tag.ToString(); - this.ReLoadTheme(themeName); + ReLoadTheme(themeName); // update and save settings to file. GeneralSettings settings = SettingsUtils.GetSettings(string.Empty); diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs index ccf1b9ea1f..55f3d6feff 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ImageResizerPage.xaml.cs @@ -2,32 +2,18 @@ // 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 { - public sealed partial class ImageResizerPage : Page { public ImageResizerViewModel ViewModel { get; } = new ImageResizerViewModel(); public ImageResizerPage() { - this.InitializeComponent(); + InitializeComponent(); } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml.cs index c561385a11..838c109e3f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/KeyboardManagerPage.xaml.cs @@ -16,7 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public KeyboardManagerPage() { - this.InitializeComponent(); + InitializeComponent(); } } } 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 87bfb5f087..23a7df94d0 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml.cs @@ -18,33 +18,33 @@ namespace Microsoft.PowerToys.Settings.UI.Views public PowerLauncherPage() { - this.InitializeComponent(); + InitializeComponent(); var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); - this.searchResultPreferencesOptions = new ObservableCollection>(); - this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order")); - this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used")); - this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications")); + searchResultPreferencesOptions = new ObservableCollection>(); + searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order")); + searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used")); + searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications")); - this.searchTypePreferencesOptions = new ObservableCollection>(); - this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name")); - this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application")); - this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name")); + searchTypePreferencesOptions = new ObservableCollection>(); + searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name")); + searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application")); + searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name")); } public Tuple SelectedSearchResultPreference { get { - return this.searchResultPreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchResultPreference); + return searchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference); } set { - if (this.ViewModel.SearchResultPreference != value.Item2) + if (ViewModel.SearchResultPreference != value.Item2) { - this.ViewModel.SearchResultPreference = value.Item2; + ViewModel.SearchResultPreference = value.Item2; } } } @@ -53,14 +53,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views { get { - return this.searchTypePreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchTypePreference); + return searchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference); } set { - if (this.ViewModel.SearchTypePreference != value.Item2) + if (ViewModel.SearchTypePreference != value.Item2) { - this.ViewModel.SearchTypePreference = value.Item2; + ViewModel.SearchTypePreference = value.Item2; } } } 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 b338a12284..452af0378d 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerPreviewPage.xaml.cs @@ -2,7 +2,6 @@ // 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 Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -15,11 +14,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views /// public sealed partial class PowerPreviewPage : Page { - private const string POWERTOY_NAME = "File Explorer Preview"; + private const string PreviewPaneKey = "File Explorer Preview"; public PowerPreviewPage() { - this.InitializeComponent(); + InitializeComponent(); } /// @@ -29,16 +28,16 @@ namespace Microsoft.PowerToys.Settings.UI.Views try { base.OnNavigatedTo(e); - settings = SettingsUtils.GetSettings(POWERTOY_NAME); - this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value; - this.ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value; + settings = SettingsUtils.GetSettings(PreviewPaneKey); + ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value; + ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value; } catch { - settings = new PowerPreviewSettings(POWERTOY_NAME); - SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOY_NAME); - this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value; - this.ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value; + settings = new PowerPreviewSettings(PreviewPaneKey); + SettingsUtils.SaveSettings(settings.ToJsonString(), PreviewPaneKey); + ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value; + ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value; } } @@ -48,7 +47,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { - PowerPreviewSettings settings = SettingsUtils.GetSettings(POWERTOY_NAME); + PowerPreviewSettings settings = SettingsUtils.GetSettings(PreviewPaneKey); settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) @@ -66,7 +65,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { - PowerPreviewSettings settings = SettingsUtils.GetSettings(POWERTOY_NAME); + PowerPreviewSettings settings = SettingsUtils.GetSettings(PreviewPaneKey); settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) @@ -77,6 +76,5 @@ namespace Microsoft.PowerToys.Settings.UI.Views } } } - } } 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 f60c81e1d7..bc8221b4c3 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerRenamePage.xaml.cs @@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public PowerRenamePage() { - this.InitializeComponent(); + InitializeComponent(); } /// @@ -31,23 +31,23 @@ namespace Microsoft.PowerToys.Settings.UI.Views try { settings = SettingsUtils.GetSettings(POWERTOYNAME); - this.UpdateView(settings); + UpdateView(settings); } catch { settings = new PowerRenameSettings(POWERTOYNAME); SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOYNAME); - this.UpdateView(settings); + UpdateView(settings); } } private void UpdateView(PowerRenameSettings settings) { - this.Toggle_PowerRename_Enable.IsOn = settings.properties.bool_mru_enabled.value; - this.Toggle_PowerRename_EnableOnExtendedContextMenu.IsOn = settings.properties.bool_show_extended_menu.value; - this.Toggle_PowerRename_MaxDispListNum.Value = settings.properties.int_max_mru_size.value; - this.Toggle_PowerRename_EnableOnContextMenu.IsOn = settings.properties.bool_show_icon_on_menu.value; - this.Toggle_PowerRename_RestoreFlagsOnLaunch.IsOn = settings.properties.bool_persist_input.value; + Toggle_PowerRename_Enable.IsOn = settings.properties.MruEnabled.value; + Toggle_PowerRename_EnableOnExtendedContextMenu.IsOn = settings.properties.ShowExtendedMenu.value; + Toggle_PowerRename_MaxDispListNum.Value = settings.properties.MaxMruSize.value; + Toggle_PowerRename_EnableOnContextMenu.IsOn = settings.properties.ShowIconInMenu.value; + Toggle_PowerRename_RestoreFlagsOnLaunch.IsOn = settings.properties.PersistInput.value; } private void Toggle_PowerRename_Enable_Toggled(object sender, RoutedEventArgs e) @@ -57,7 +57,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { PowerRenameSettings settings = SettingsUtils.GetSettings(POWERTOYNAME); - settings.properties.bool_mru_enabled.value = swt.IsOn; + settings.properties.MruEnabled.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) { @@ -75,7 +75,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { PowerRenameSettings settings = SettingsUtils.GetSettings(POWERTOYNAME); - settings.properties.bool_show_icon_on_menu.value = swt.IsOn; + settings.properties.ShowIconInMenu.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) { @@ -93,7 +93,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { PowerRenameSettings settings = SettingsUtils.GetSettings(POWERTOYNAME); - settings.properties.bool_show_extended_menu.value = swt.IsOn; + settings.properties.ShowExtendedMenu.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) { @@ -111,7 +111,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (swt != null) { PowerRenameSettings settings = SettingsUtils.GetSettings(POWERTOYNAME); - settings.properties.bool_persist_input.value = swt.IsOn; + settings.properties.PersistInput.value = swt.IsOn; if (ShellPage.DefaultSndMSGCallback != null) { @@ -127,7 +127,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (sender != null) { PowerRenameSettings settings = SettingsUtils.GetSettings(POWERTOYNAME); - settings.properties.int_max_mru_size.value = Convert.ToInt32(sender.Value); + settings.properties.MaxMruSize.value = Convert.ToInt32(sender.Value); if (ShellPage.DefaultSndMSGCallback != null) { @@ -139,4 +139,3 @@ namespace Microsoft.PowerToys.Settings.UI.Views } } } - diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs index 7987253c2b..9d83ff7d3c 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs @@ -39,12 +39,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views /// public ShellPage() { - this.InitializeComponent(); + InitializeComponent(); - this.DataContext = this.ViewModel; + DataContext = ViewModel; ShellHandler = this; - this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators); - this.shellFrame.Navigate(typeof(GeneralPage)); + ViewModel.Initialize(shellFrame, navigationView, KeyboardAccelerators); + shellFrame.Navigate(typeof(GeneralPage)); } /// diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml.cs b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml.cs index 68712c8534..fe5d0c57d6 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShortcutGuidePage.xaml.cs @@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views public ShortcutGuidePage() { - this.InitializeComponent(); + InitializeComponent(); } } } diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj index 6fa497a873..21cc70da14 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj +++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj @@ -233,7 +233,7 @@ 2.0.0-alpha0455 - 4.7.0 + 4.7.1 1.1.118