diff --git a/PowerToys.sln b/PowerToys.sln index 77c12b0a80..91667d4eb7 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -180,12 +180,16 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.Test", "src\core\Microsoft.PowerToys.Settings.Test\Microsoft.PowerToys.Settings.Test.csproj", "{6F2B5799-36AE-4D10-9DCF-B19CD26A5DBC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.Runner", "src\core\Microsoft.PowerToys.Settings.UI.Runner\Microsoft.PowerToys.Settings.UI.Runner.csproj", "{E4E0D2AE-B17D-4BD4-8BEE-AFC8CC464C5F}" + ProjectSection(ProjectDependencies) = postProject + {F88B6FD1-14BD-48DB-85C2-6C51B8045121} = {F88B6FD1-14BD-48DB-85C2-6C51B8045121} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.TwoWayIPCLib", "src\core\Microsoft.PowerToys.Settings.TwoWayIPCLib\TwoWayIPCLib.vcxproj", "{F88B6FD1-14BD-48DB-85C2-6C51B8045121}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Settings.UI", "src\core\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj", "{4EB9C181-96E2-4587-AB98-2DB84C1A2310}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.PowerToys.Settings.IPCWrapperPS", "src\core\Microsoft.PowerToys.Settings.IPCWrapperPS\Microsoft.PowerToys.Settings.IPCWrapperPS.vcxproj", "{C073B057-B157-40F0-8678-1DCD119D841C}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig @@ -642,14 +646,22 @@ Global {C073B057-B157-40F0-8678-1DCD119D841C}.Release|ARM64.ActiveCfg = Release|Win32 {C073B057-B157-40F0-8678-1DCD119D841C}.Release|x64.ActiveCfg = Release|x64 {C073B057-B157-40F0-8678-1DCD119D841C}.Release|x86.ActiveCfg = Release|Win32 - {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM.Build.0 = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM64.Build.0 = Debug|Any CPU {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.ActiveCfg = Debug|Any CPU {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.Build.0 = Debug|Any CPU - {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|Any CPU.Build.0 = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x86.ActiveCfg = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x86.Build.0 = Debug|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|ARM.ActiveCfg = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|ARM.Build.0 = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|ARM64.ActiveCfg = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|ARM64.Build.0 = Release|Any CPU {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.ActiveCfg = Release|Any CPU {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x64.Build.0 = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x86.ActiveCfg = Release|Any CPU + {B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs index 3c366281ff..4ef28a82c6 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/HotkeySettings.cs @@ -1,5 +1,7 @@ -using System; -using System.Collections.Generic; +// 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.Text; namespace Microsoft.PowerToys.Settings.UI.Lib @@ -7,33 +9,42 @@ namespace Microsoft.PowerToys.Settings.UI.Lib public class HotkeySettings { public bool win { get; set; } + public bool ctrl { get; set; } + public bool alt { get; set; } + public bool shift { get; set; } + public string key { get; set; } + public int code { get; set; } public override string ToString() { StringBuilder output = new StringBuilder(); - if (win) + if (this.win) { output.Append("Win + "); } - if (ctrl) + + if (this.ctrl) { output.Append("Ctrl + "); } - if (alt) + + if (this.alt) { output.Append("Alt + "); } - if (shift) + + if (this.shift) { output.Append("Shift + "); } - output.Append(key); + + output.Append(this.key); return output.ToString(); } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs new file mode 100644 index 0000000000..5dec531a7b --- /dev/null +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherProperties.cs @@ -0,0 +1,39 @@ +// 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.Lib +{ + public class PowerLauncherProperties + { + public bool enable_powerlauncher { get; set; } + + public string search_result_preference { get; set; } + + public string search_type_preference { get; set; } + + public int maximum_number_of_results { get; set; } + + public HotkeySettings open_powerlauncher { get; set; } + + public HotkeySettings open_file_location { get; set; } + + public HotkeySettings copy_path_location { get; set; } + + public HotkeySettings open_console { get; set; } + + public bool override_win_r_key { get; set; } + + public bool override_win_s_key { get; set; } + + 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"; + } + } +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs index caf722f830..e841ee93ee 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerLauncherSettings.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Text; +// 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.Lib { public class PowerLauncherSettings : BasePTModuleSettings { public PowerLauncherProperties properties { get; set; } - + public PowerLauncherSettings() { this.properties = new PowerLauncherProperties(); @@ -15,28 +15,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib this.name = "_unset_"; } } - - public class PowerLauncherProperties - { - public bool enable_powerlauncher { get; set; } - public string search_result_preference { get; set; } - public string search_type_preference { get; set; } - public int maximum_number_of_results { get; set; } - public HotkeySettings open_powerlauncher { get; set; } - public HotkeySettings open_file_location { get; set; } - public HotkeySettings copy_path_location { get; set; } - public HotkeySettings open_console { get; set; } - public bool override_win_r_key { get; set; } - public bool override_win_s_key { get; set; } - - public PowerLauncherProperties() - { - 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/PowerPreviewProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs index dda6581acc..382b0f76f1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerPreviewProperties.cs @@ -10,10 +10,10 @@ using System.Text.Json.Serialization; namespace Microsoft.PowerToys.Settings.UI.Lib { - public class PowerPreviewProperties { public BoolProperty IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL { get; set; } + public BoolProperty PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID { get; set; } public PowerPreviewProperties() diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs index be89013119..b7d7a60ff7 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameProperties.cs @@ -20,10 +20,13 @@ namespace Microsoft.PowerToys.Settings.UI.Lib } public BoolProperty bool_persist_input { get; set; } + public BoolProperty bool_mru_enabled { get; set; } + public IntProperty int_max_mru_size { get; set; } + public BoolProperty bool_show_icon_on_menu { get; set; } + public BoolProperty bool_show_extended_menu { 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 9cf7af579a..43bd334cae 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs @@ -30,4 +30,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib return JsonSerializer.Serialize(this); } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs index e349d7f7d4..bddf7024db 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SettingsUtils.cs @@ -1,18 +1,15 @@ -using System; -using System.Collections.Generic; +// 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.IO; -using System.Text; using System.Text.Json; namespace Microsoft.PowerToys.Settings.UI.Lib { public static class SettingsUtils { - private static string LocalApplicationDataFolder() - { - return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - } - public static bool SettingsFolderExists(string powertoy) { return Directory.Exists(Path.Combine(LocalApplicationDataFolder(), $"Microsoft\\PowerToys\\{powertoy}")); @@ -59,16 +56,22 @@ namespace Microsoft.PowerToys.Settings.UI.Lib // Save settings to a json file. public static void SaveSettings(string jsonSettings, string powertoy) { - if(jsonSettings != null) + if (jsonSettings != null) { if (!SettingsFolderExists(powertoy)) { CreateSettingsFolder(powertoy); } + System.IO.File.WriteAllText( SettingsUtils.GetSettingsPath(powertoy), jsonSettings); } } + + private static string LocalApplicationDataFolder() + { + return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs index 9ff6348f73..c712df3345 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerPreviewSettings.cs @@ -10,7 +10,6 @@ using System.Text.Json.Serialization; namespace Microsoft.PowerToys.Settings.UI.Lib { - public class SndPowerPreviewSettings { [JsonPropertyName("File Explorer Preview")] diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs index b5a5e8f062..f3499c855f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Lib/SndPowerRenameSettings.cs @@ -22,4 +22,4 @@ namespace Microsoft.PowerToys.Settings.UI.Lib return JsonSerializer.Serialize(this); } } -} \ No newline at end of file +} 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 fc5a404c28..5f58228f0e 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Controls/HotkeySettingsControl.xaml.cs @@ -1,25 +1,14 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using System.Text; -using Windows.Foundation; -using Windows.Foundation.Collections; +// 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.Lib; using Windows.UI.Core; 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; -using Microsoft.PowerToys.Settings.UI.Lib; -using System.ComponentModel; -using System.Runtime.CompilerServices; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - namespace Microsoft.PowerToys.Settings.UI.Controls { public sealed partial class HotkeySettingsControl : UserControl @@ -28,30 +17,35 @@ namespace Microsoft.PowerToys.Settings.UI.Controls public static readonly DependencyProperty HotkeySettingsProperty = DependencyProperty.Register( - "HotkeySettings", + "HotkeySettings", typeof(HotkeySettings), typeof(HotkeySettingsControl), null); - private HotkeySettings _hotkeySettings; - public HotkeySettings HotkeySettings - { - get { return _hotkeySettings; } - set + private HotkeySettings hotkeySettings; + + public HotkeySettings HotkeySettings + { + get { - if (_hotkeySettings != value) + return this.hotkeySettings; + } + + set + { + if (this.hotkeySettings != value) { - _hotkeySettings = value; - SetValue(HotkeySettingsProperty, value); - HotkeyTextBox.Text = HotkeySettings.ToString(); + this.hotkeySettings = value; + this.SetValue(HotkeySettingsProperty, value); + this.HotkeyTextBox.Text = this.HotkeySettings.ToString(); } - } + } } public HotkeySettingsControl() { this.InitializeComponent(); - HotkeyTextBox.PreviewKeyDown += HotkeyTextBox_KeyDown; + this.HotkeyTextBox.PreviewKeyDown += this.HotkeyTextBox_KeyDown; } private static bool IsDown(Windows.System.VirtualKey key) @@ -67,27 +61,30 @@ namespace Microsoft.PowerToys.Settings.UI.Controls e.Key == Windows.System.VirtualKey.RightWindows || e.Key == Windows.System.VirtualKey.Control || e.Key == Windows.System.VirtualKey.Menu || - e.Key == Windows.System.VirtualKey.Shift - ) + e.Key == Windows.System.VirtualKey.Shift) { return; } var settings = new HotkeySettings(); + // Display HotKey value - if (IsDown(Windows.System.VirtualKey.LeftWindows) || + if (IsDown(Windows.System.VirtualKey.LeftWindows) || IsDown(Windows.System.VirtualKey.RightWindows)) { settings.win = true; } + if (IsDown(Windows.System.VirtualKey.Control)) { settings.ctrl = true; } + if (IsDown(Windows.System.VirtualKey.Menu)) { settings.alt = true; } + if (IsDown(Windows.System.VirtualKey.Shift)) { settings.shift = true; @@ -96,8 +93,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls settings.key = e.Key.ToString(); // TODO: Check that e.OriginalKey is the ScanCode. It is not clear from docs. - settings.code = (int) e.OriginalKey; - HotkeySettings = settings; + settings.code = (int)e.OriginalKey; + this.HotkeySettings = settings; } } } 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 bf58edc23a..d476a77146 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 @@ -123,6 +123,9 @@ + + HotkeySettingsControl.xaml + @@ -205,6 +208,10 @@ + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs index a4d4788c07..53d7654215 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -1,181 +1,218 @@ // 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.Runtime.CompilerServices; using System.Text.Json; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Lib; using Microsoft.PowerToys.Settings.UI.Views; -using Windows.UI.Xaml.Controls; namespace Microsoft.PowerToys.Settings.UI.ViewModels { public class PowerLauncherViewModel : Observable { - public PowerLauncherSettings settings; - private const string POWERTOY_NAME = "PowerLauncher"; - + private const string POWERTOYNAME = "PowerLauncher"; + private PowerLauncherSettings settings; public PowerLauncherViewModel() { - if (SettingsUtils.SettingsExists(POWERTOY_NAME)) + if (SettingsUtils.SettingsExists(POWERTOYNAME)) { - settings = SettingsUtils.GetSettings(POWERTOY_NAME); - } else + this.settings = SettingsUtils.GetSettings(POWERTOYNAME); + } + else { - settings = new PowerLauncherSettings(); + this.settings = new PowerLauncherSettings(); } } private void UpdateSettings([CallerMemberName] string propertyName = null) { // Notify UI of property change - OnPropertyChanged(propertyName); + this.OnPropertyChanged(propertyName); // Save settings to file var options = new JsonSerializerOptions { - WriteIndented = true + WriteIndented = true, }; - SettingsUtils.SaveSettings(JsonSerializer.Serialize(settings, options), POWERTOY_NAME); + SettingsUtils.SaveSettings(JsonSerializer.Serialize(this.settings, options), POWERTOYNAME); // Propagate changes to Power Launcher through IPC - var propertiesJson = JsonSerializer.Serialize(settings.properties); - ShellPage.Default_SndMSG_Callback( - string.Format("{{ \"{0}\": {1} }}", POWERTOY_NAME, JsonSerializer.Serialize(settings.properties))); + var propertiesJson = JsonSerializer.Serialize(this.settings.properties); + ShellPage.DefaultSndMSGCallback( + string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(this.settings.properties))); } public bool EnablePowerLauncher { - get { return settings.properties.enable_powerlauncher; } - set + get { - if (settings.properties.enable_powerlauncher != value) + return this.settings.properties.enable_powerlauncher; + } + + set + { + if (this.settings.properties.enable_powerlauncher != value) { - settings.properties.enable_powerlauncher = value; - UpdateSettings(); + this.settings.properties.enable_powerlauncher = value; + this.UpdateSettings(); } } } public string SearchResultPreference { - get { return settings.properties.search_result_preference; } - set + get { - if (settings.properties.search_result_preference != value) + return this.settings.properties.search_result_preference; + } + + set + { + if (this.settings.properties.search_result_preference != value) { - settings.properties.search_result_preference = value; - UpdateSettings(); + this.settings.properties.search_result_preference = value; + this.UpdateSettings(); } } } public string SearchTypePreference { - get { return settings.properties.search_type_preference; } + get + { + return this.settings.properties.search_type_preference; + } + set { - if (settings.properties.search_type_preference != value) + if (this.settings.properties.search_type_preference != value) { - settings.properties.search_type_preference = value; - UpdateSettings(); + this.settings.properties.search_type_preference = value; + this.UpdateSettings(); } } } public int MaximumNumberOfResults { - get { return settings.properties.maximum_number_of_results; } + get + { + return this.settings.properties.maximum_number_of_results; + } + set { - if (settings.properties.maximum_number_of_results != value) + if (this.settings.properties.maximum_number_of_results != value) { - settings.properties.maximum_number_of_results = value; - UpdateSettings(); + this.settings.properties.maximum_number_of_results = value; + this.UpdateSettings(); } } } public HotkeySettings OpenPowerLauncher { - get { return settings.properties.open_powerlauncher; } + get + { + return this.settings.properties.open_powerlauncher; + } + set { - if (settings.properties.open_powerlauncher != value) + if (this.settings.properties.open_powerlauncher != value) { - settings.properties.open_powerlauncher = value; - UpdateSettings(); - } + this.settings.properties.open_powerlauncher = value; + this.UpdateSettings(); + } } } public HotkeySettings OpenFileLocation { - get { return settings.properties.open_file_location; } + get + { + return this.settings.properties.open_file_location; + } + set { - if (settings.properties.open_file_location != value) + if (this.settings.properties.open_file_location != value) { - settings.properties.open_file_location = value; - UpdateSettings(); + this.settings.properties.open_file_location = value; + this.UpdateSettings(); } } } public HotkeySettings CopyPathLocation { - get { return settings.properties.copy_path_location; } + get + { + return this.settings.properties.copy_path_location; + } + set { - if (settings.properties.copy_path_location != value) + if (this.settings.properties.copy_path_location != value) { - settings.properties.copy_path_location = value; - UpdateSettings(); + this.settings.properties.copy_path_location = value; + this.UpdateSettings(); } } } public HotkeySettings OpenConsole { - get { return settings.properties.open_console; } + get + { + return this.settings.properties.open_console; + } + set { - if (settings.properties.open_console != value) + if (this.settings.properties.open_console != value) { - settings.properties.open_console = value; - UpdateSettings(); + this.settings.properties.open_console = value; + this.UpdateSettings(); } } } public bool OverrideWinRKey { - get { return settings.properties.override_win_r_key; } + get + { + return this.settings.properties.override_win_r_key; + } + set { - if (settings.properties.override_win_r_key != value) + if (this.settings.properties.override_win_r_key != value) { - settings.properties.override_win_r_key = value; - UpdateSettings(); + this.settings.properties.override_win_r_key = value; + this.UpdateSettings(); } } } public bool OverrideWinSKey { - get { return settings.properties.override_win_s_key; } + get + { + return this.settings.properties.override_win_s_key; + } + set { - if (settings.properties.override_win_s_key != value) + if (this.settings.properties.override_win_s_key != value) { - settings.properties.override_win_s_key = value; - UpdateSettings(); + this.settings.properties.override_win_s_key = value; + this.UpdateSettings(); } } } } -} \ No newline at end of file +} diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml index b19f631e65..88ea4d939e 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/PowerLauncherPage.xaml @@ -56,7 +56,7 @@ > SearchResultPreferencesOptions; - ObservableCollection> SearchTypePreferencesOptions; + + private readonly ObservableCollection> searchResultPreferencesOptions; + private readonly ObservableCollection> searchTypePreferencesOptions; public PowerLauncherPage() { this.InitializeComponent(); var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); - - 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")); - 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")); + 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")); + 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")); } public Tuple SelectedSearchResultPreference { get { - return SearchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference); + return this.searchResultPreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchResultPreference); } + set { - if (ViewModel.SearchResultPreference != value.Item2) + if (this.ViewModel.SearchResultPreference != value.Item2) { - ViewModel.SearchResultPreference = value.Item2; + this.ViewModel.SearchResultPreference = value.Item2; } } } @@ -66,13 +53,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views { get { - return SearchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference); + return this.searchTypePreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchTypePreference); } + set { - if (ViewModel.SearchTypePreference != value.Item2) + if (this.ViewModel.SearchTypePreference != value.Item2) { - ViewModel.SearchTypePreference = value.Item2; + this.ViewModel.SearchTypePreference = value.Item2; } } } 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 aa0fa38528..7987253c2b 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/Views/ShellPage.xaml.cs @@ -1,4 +1,8 @@ -using Microsoft.PowerToys.Settings.UI.ViewModels; +// 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.ViewModels; using Windows.UI.Xaml.Controls; namespace Microsoft.PowerToys.Settings.UI.Views diff --git a/src/modules/windowwalker/app/Window Walker/ViewModels/WindowWalkerViewModel.cs b/src/modules/windowwalker/app/Window Walker/ViewModels/WindowWalkerViewModel.cs index 2b5fd6dcad..cd52d9d2fe 100644 --- a/src/modules/windowwalker/app/Window Walker/ViewModels/WindowWalkerViewModel.cs +++ b/src/modules/windowwalker/app/Window Walker/ViewModels/WindowWalkerViewModel.cs @@ -18,6 +18,7 @@ namespace WindowWalker.ViewModels private readonly List _hints = new List() { "search for running processes or windows...", + // "you can reinvoke this app using CTRL + WIN", };