mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Settingsv2 fix warnings (#2076)
* updating a ton of warnings. * bunch of cleanup * few smaller ones * fixed naming * reversing an oops * adjusting json to use attribute * more json properties
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Licensed to the .NET Foundation under one or more agreements.
|
// Copyright (c) Microsoft Corporation
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
// This file is used by Code Analysis to maintain SuppressMessage
|
// This file is used by Code Analysis to maintain SuppressMessage
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public GeneralSettings()
|
public GeneralSettings()
|
||||||
{
|
{
|
||||||
this.Packaged = false;
|
Packaged = false;
|
||||||
this.startup = false;
|
startup = false;
|
||||||
this.is_admin = false;
|
is_admin = false;
|
||||||
this.is_elevated = false;
|
is_elevated = false;
|
||||||
this.theme = "system";
|
theme = "system";
|
||||||
this.system_theme = "light";
|
system_theme = "light";
|
||||||
this.powertoys_version = "v0.15.3";
|
powertoys_version = "v0.15.3";
|
||||||
}
|
}
|
||||||
|
|
||||||
// converts the current to a json string.
|
// converts the current to a json string.
|
||||||
|
|||||||
@@ -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.")]
|
|
||||||
@@ -24,27 +24,27 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
if (this.win)
|
if (win)
|
||||||
{
|
{
|
||||||
output.Append("Win + ");
|
output.Append("Win + ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ctrl)
|
if (ctrl)
|
||||||
{
|
{
|
||||||
output.Append("Ctrl + ");
|
output.Append("Ctrl + ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.alt)
|
if (alt)
|
||||||
{
|
{
|
||||||
output.Append("Alt + ");
|
output.Append("Alt + ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shift)
|
if (shift)
|
||||||
{
|
{
|
||||||
output.Append("Shift + ");
|
output.Append("Shift + ");
|
||||||
}
|
}
|
||||||
|
|
||||||
output.Append(this.key);
|
output.Append(key);
|
||||||
return output.ToString();
|
return output.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public KeyboardManagerProperties()
|
public KeyboardManagerProperties()
|
||||||
{
|
{
|
||||||
this.EditShortcut = new BoolProperty();
|
EditShortcut = new BoolProperty();
|
||||||
this.RemapKeyboard = new BoolProperty();
|
RemapKeyboard = new BoolProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
|
|||||||
@@ -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.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||||
{
|
{
|
||||||
public class KeyboardManagerSettings : BasePTModuleSettings
|
public class KeyboardManagerSettings : BasePTModuleSettings
|
||||||
{
|
{
|
||||||
public KeyboardManagerProperties properties { get; set; }
|
[JsonPropertyName("properties")]
|
||||||
|
public KeyboardManagerProperties Properties { get; set; }
|
||||||
|
|
||||||
public KeyboardManagerSettings()
|
public KeyboardManagerSettings()
|
||||||
{
|
{
|
||||||
this.properties = new KeyboardManagerProperties();
|
Properties = new KeyboardManagerProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = "_unset_";
|
name = "_unset_";
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardManagerSettings(string ptName)
|
public KeyboardManagerSettings(string ptName)
|
||||||
{
|
{
|
||||||
this.properties = new KeyboardManagerProperties();
|
Properties = new KeyboardManagerProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = ptName;
|
name = ptName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
</AdditionalFiles>
|
</AdditionalFiles>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public OutGoingGeneralSettings()
|
public OutGoingGeneralSettings()
|
||||||
{
|
{
|
||||||
this.general = null;
|
general = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutGoingGeneralSettings(GeneralSettings generalSettings)
|
public OutGoingGeneralSettings(GeneralSettings generalSettings)
|
||||||
{
|
{
|
||||||
this.general = generalSettings;
|
general = generalSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public PowerLauncherProperties()
|
public PowerLauncherProperties()
|
||||||
{
|
{
|
||||||
this.open_powerlauncher = new HotkeySettings();
|
open_powerlauncher = new HotkeySettings();
|
||||||
this.open_file_location = new HotkeySettings();
|
open_file_location = new HotkeySettings();
|
||||||
this.copy_path_location = new HotkeySettings();
|
copy_path_location = new HotkeySettings();
|
||||||
this.open_console = new HotkeySettings();
|
open_console = new HotkeySettings();
|
||||||
this.search_result_preference = "most_recently_used";
|
search_result_preference = "most_recently_used";
|
||||||
this.search_type_preference = "application_name";
|
search_type_preference = "application_name";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public PowerLauncherSettings()
|
public PowerLauncherSettings()
|
||||||
{
|
{
|
||||||
this.properties = new PowerLauncherProperties();
|
properties = new PowerLauncherProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = "_unset_";
|
name = "_unset_";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public PowerPreviewProperties()
|
public PowerPreviewProperties()
|
||||||
{
|
{
|
||||||
this.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new BoolProperty();
|
IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL = new BoolProperty();
|
||||||
this.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new BoolProperty();
|
PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID = new BoolProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public PowerPreviewSettings()
|
public PowerPreviewSettings()
|
||||||
{
|
{
|
||||||
this.properties = new PowerPreviewProperties();
|
properties = new PowerPreviewProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = "_unset_";
|
name = "_unset_";
|
||||||
}
|
}
|
||||||
|
|
||||||
public PowerPreviewSettings(string ptName)
|
public PowerPreviewSettings(string ptName)
|
||||||
{
|
{
|
||||||
this.properties = new PowerPreviewProperties();
|
properties = new PowerPreviewProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = ptName;
|
name = ptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToJsonString()
|
public override string ToJsonString()
|
||||||
|
|||||||
@@ -2,31 +2,34 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||||
{
|
{
|
||||||
|
|
||||||
public class PowerRenameProperties
|
public class PowerRenameProperties
|
||||||
{
|
{
|
||||||
public PowerRenameProperties()
|
public PowerRenameProperties()
|
||||||
{
|
{
|
||||||
this.bool_persist_input = new BoolProperty();
|
PersistInput = new BoolProperty();
|
||||||
this.bool_mru_enabled = new BoolProperty();
|
MruEnabled = new BoolProperty();
|
||||||
this.int_max_mru_size = new IntProperty();
|
MaxMruSize = new IntProperty();
|
||||||
this.bool_show_icon_on_menu = new BoolProperty();
|
ShowIconInMenu = new BoolProperty();
|
||||||
this.bool_show_extended_menu = 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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public PowerRenameSettings()
|
public PowerRenameSettings()
|
||||||
{
|
{
|
||||||
this.properties = new PowerRenameProperties();
|
properties = new PowerRenameProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = "_unset_";
|
name = "_unset_";
|
||||||
}
|
}
|
||||||
|
|
||||||
public PowerRenameSettings(string ptName)
|
public PowerRenameSettings(string ptName)
|
||||||
{
|
{
|
||||||
this.properties = new PowerRenameProperties();
|
properties = new PowerRenameProperties();
|
||||||
this.version = "1";
|
version = "1";
|
||||||
this.name = ptName;
|
name = ptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToJsonString()
|
public override string ToJsonString()
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public static bool SettingsExists(string powertoy)
|
public static bool SettingsExists(string powertoy)
|
||||||
{
|
{
|
||||||
return File.Exists(SettingsUtils.GetSettingsPath(powertoy));
|
return File.Exists(GetSettingsPath(powertoy));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,7 +49,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
/// <returns>Deserialized json settings object.</returns>
|
/// <returns>Deserialized json settings object.</returns>
|
||||||
public static T GetSettings<T>(string powertoy)
|
public static T GetSettings<T>(string powertoy)
|
||||||
{
|
{
|
||||||
var jsonSettingsString = System.IO.File.ReadAllText(SettingsUtils.GetSettingsPath(powertoy));
|
var jsonSettingsString = File.ReadAllText(GetSettingsPath(powertoy));
|
||||||
return JsonSerializer.Deserialize<T>(jsonSettingsString);
|
return JsonSerializer.Deserialize<T>(jsonSettingsString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,9 +63,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
CreateSettingsFolder(powertoy);
|
CreateSettingsFolder(powertoy);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IO.File.WriteAllText(
|
File.WriteAllText(GetSettingsPath(powertoy), jsonSettings);
|
||||||
SettingsUtils.GetSettingsPath(powertoy),
|
|
||||||
jsonSettings);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
public class SndKeyboardManagerSettings
|
public class SndKeyboardManagerSettings
|
||||||
{
|
{
|
||||||
[JsonPropertyName("Keyboard Manager")]
|
[JsonPropertyName("Keyboard Manager")]
|
||||||
public KeyboardManagerSettings keyboardManagerSettings { get; }
|
public KeyboardManagerSettings KeyboardManagerSettings { get; }
|
||||||
|
|
||||||
public SndKeyboardManagerSettings(KeyboardManagerSettings keyboardManagerSettings)
|
public SndKeyboardManagerSettings(KeyboardManagerSettings keyboardManagerSettings)
|
||||||
{
|
{
|
||||||
this.keyboardManagerSettings = keyboardManagerSettings;
|
KeyboardManagerSettings = keyboardManagerSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public SndModuleSettings(T settings)
|
public SndModuleSettings(T settings)
|
||||||
{
|
{
|
||||||
this.powertoys = settings;
|
powertoys = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public SndPowerPreviewSettings(PowerPreviewSettings settings)
|
public SndPowerPreviewSettings(PowerPreviewSettings settings)
|
||||||
{
|
{
|
||||||
this.File_Explorer_Preview = settings;
|
File_Explorer_Preview = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
|||||||
|
|
||||||
public SndPowerRenameSettings(PowerRenameSettings settings)
|
public SndPowerRenameSettings(PowerRenameSettings settings)
|
||||||
{
|
{
|
||||||
this.PowerRename = settings;
|
PowerRename = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
using System;
|
// Copyright (c) Microsoft Corporation
|
||||||
using System.Collections.Generic;
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
using System.Configuration;
|
// See the LICENSE file in the project root for more information.
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Runner
|
namespace Microsoft.PowerToys.Settings.UI.Runner
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
using System.Windows;
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||||
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)
|
|
||||||
)]
|
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@
|
|||||||
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
<AdditionalFiles Include="..\..\codeAnalysis\StyleCop.json" Link="StyleCop.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs" Link="GlobalSuppressions.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\settingsui\Assets\logo.png">
|
<None Include="..\settingsui\Assets\logo.png">
|
||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
@@ -70,4 +74,8 @@
|
|||||||
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
|
<ProjectReference Include="..\Microsoft.PowerToys.Settings.UI\Microsoft.PowerToys.Settings.UI.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="Microsoft.VCRTForwarders.140" Version="1.0.5" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
// Create an instance of the IPC wrapper.
|
// Create an instance of the IPC wrapper.
|
||||||
private static ITwoWayIPCManager ipcmanager = new TwoWayIPCManager();
|
private static ITwoWayIPCManager ipcmanager = new TwoWayIPCManager();
|
||||||
|
|
||||||
[STAThreadAttribute()]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
using (new UI.App())
|
using (new UI.App())
|
||||||
|
|||||||
@@ -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;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Activation
|
namespace Microsoft.PowerToys.Settings.UI.Activation
|
||||||
@@ -12,19 +15,19 @@ namespace Microsoft.PowerToys.Settings.UI.Activation
|
|||||||
public abstract Task HandleAsync(object args);
|
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<T> : ActivationHandler
|
internal abstract class ActivationHandler<T> : ActivationHandler
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
public override async Task HandleAsync(object args)
|
public override async Task HandleAsync(object args)
|
||||||
{
|
{
|
||||||
await this.HandleInternalAsync(args as T);
|
await HandleInternalAsync(args as T);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanHandle(object args)
|
public override bool CanHandle(object args)
|
||||||
{
|
{
|
||||||
// CanHandle checks the args is of type you have configured
|
// 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
|
// Override this method to add the activation logic in your activation handler
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ namespace Microsoft.PowerToys.Settings.UI.Activation
|
|||||||
arguments = launchArgs.Arguments;
|
arguments = launchArgs.Arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationService.Navigate(this.navElement, arguments);
|
NavigationService.Navigate(navElement, arguments);
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CanHandleInternal(IActivatedEventArgs args)
|
protected override bool CanHandleInternal(IActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
// None of the ActivationHandlers has handled the app activation
|
// None of the ActivationHandlers has handled the app activation
|
||||||
return NavigationService.Frame.Content == null && this.navElement != null;
|
return NavigationService.Frame.Content == null && navElement != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
namespace Microsoft.PowerToys.Settings.UI
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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 Microsoft.Xaml.Interactivity;
|
||||||
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
@@ -18,8 +22,8 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors
|
|||||||
|
|
||||||
public object DefaultHeader
|
public object DefaultHeader
|
||||||
{
|
{
|
||||||
get { return this.GetValue(DefaultHeaderProperty); }
|
get { return GetValue(DefaultHeaderProperty); }
|
||||||
set { this.SetValue(DefaultHeaderProperty, value); }
|
set { SetValue(DefaultHeaderProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty DefaultHeaderProperty = DependencyProperty.Register("DefaultHeader", typeof(object), typeof(NavigationViewHeaderBehavior), new PropertyMetadata(null, (d, e) => current.UpdateHeader()));
|
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();
|
base.OnAttached();
|
||||||
current = this;
|
current = this;
|
||||||
NavigationService.Navigated += this.OnNavigated;
|
NavigationService.Navigated += OnNavigated;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDetaching()
|
protected override void OnDetaching()
|
||||||
{
|
{
|
||||||
base.OnDetaching();
|
base.OnDetaching();
|
||||||
NavigationService.Navigated -= this.OnNavigated;
|
NavigationService.Navigated -= OnNavigated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnNavigated(object sender, NavigationEventArgs e)
|
private void OnNavigated(object sender, NavigationEventArgs e)
|
||||||
@@ -81,42 +85,42 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors
|
|||||||
var frame = sender as Frame;
|
var frame = sender as Frame;
|
||||||
if (frame.Content is Page page)
|
if (frame.Content is Page page)
|
||||||
{
|
{
|
||||||
this.currentPage = page;
|
currentPage = page;
|
||||||
|
|
||||||
this.UpdateHeader();
|
UpdateHeader();
|
||||||
this.UpdateHeaderTemplate();
|
UpdateHeaderTemplate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHeader()
|
private void UpdateHeader()
|
||||||
{
|
{
|
||||||
if (this.currentPage != null)
|
if (currentPage != null)
|
||||||
{
|
{
|
||||||
var headerMode = GetHeaderMode(this.currentPage);
|
var headerMode = GetHeaderMode(currentPage);
|
||||||
if (headerMode == NavigationViewHeaderMode.Never)
|
if (headerMode == NavigationViewHeaderMode.Never)
|
||||||
{
|
{
|
||||||
this.AssociatedObject.Header = null;
|
AssociatedObject.Header = null;
|
||||||
this.AssociatedObject.AlwaysShowHeader = false;
|
AssociatedObject.AlwaysShowHeader = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var headerFromPage = GetHeaderContext(this.currentPage);
|
var headerFromPage = GetHeaderContext(currentPage);
|
||||||
if (headerFromPage != null)
|
if (headerFromPage != null)
|
||||||
{
|
{
|
||||||
this.AssociatedObject.Header = headerFromPage;
|
AssociatedObject.Header = headerFromPage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.AssociatedObject.Header = this.DefaultHeader;
|
AssociatedObject.Header = DefaultHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headerMode == NavigationViewHeaderMode.Always)
|
if (headerMode == NavigationViewHeaderMode.Always)
|
||||||
{
|
{
|
||||||
this.AssociatedObject.AlwaysShowHeader = true;
|
AssociatedObject.AlwaysShowHeader = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.AssociatedObject.AlwaysShowHeader = false;
|
AssociatedObject.AlwaysShowHeader = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,10 +128,10 @@ namespace Microsoft.PowerToys.Settings.UI.Behaviors
|
|||||||
|
|
||||||
private void UpdateHeaderTemplate()
|
private void UpdateHeaderTemplate()
|
||||||
{
|
{
|
||||||
if (this.currentPage != null)
|
if (currentPage != null)
|
||||||
{
|
{
|
||||||
var headerTemplate = GetHeaderTemplate(this.currentPage);
|
var headerTemplate = GetHeaderTemplate(currentPage);
|
||||||
this.AssociatedObject.HeaderTemplate = headerTemplate ?? this.DefaultHeaderTemplate;
|
AssociatedObject.HeaderTemplate = headerTemplate ?? DefaultHeaderTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
public enum NavigationViewHeaderMode
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,24 +28,24 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.hotkeySettings;
|
return hotkeySettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.hotkeySettings != value)
|
if (hotkeySettings != value)
|
||||||
{
|
{
|
||||||
this.hotkeySettings = value;
|
hotkeySettings = value;
|
||||||
this.SetValue(HotkeySettingsProperty, value);
|
SetValue(HotkeySettingsProperty, value);
|
||||||
this.HotkeyTextBox.Text = this.HotkeySettings.ToString();
|
HotkeyTextBox.Text = HotkeySettings.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HotkeySettingsControl()
|
public HotkeySettingsControl()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
this.HotkeyTextBox.PreviewKeyDown += this.HotkeyTextBox_KeyDown;
|
HotkeyTextBox.PreviewKeyDown += HotkeyTextBox_KeyDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsDown(Windows.System.VirtualKey key)
|
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.
|
// TODO: Check that e.OriginalKey is the ScanCode. It is not clear from docs.
|
||||||
settings.code = (int)e.OriginalKey;
|
settings.code = (int)e.OriginalKey;
|
||||||
this.HotkeySettings = settings;
|
HotkeySettings = settings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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")]
|
|
||||||
@@ -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.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
@@ -16,9 +19,9 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
storage = value;
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||||
{
|
{
|
||||||
public class RelayCommand : ICommand
|
public class RelayCommand : ICommand
|
||||||
{
|
{
|
||||||
private readonly Action execute;
|
private readonly Action _execute;
|
||||||
|
private readonly Func<bool> _canExecute;
|
||||||
private readonly Func<bool> canExecute;
|
|
||||||
|
|
||||||
public event EventHandler CanExecuteChanged;
|
public event EventHandler CanExecuteChanged;
|
||||||
|
|
||||||
@@ -18,17 +21,18 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
|||||||
|
|
||||||
public RelayCommand(Action execute, Func<bool> canExecute)
|
public RelayCommand(Action execute, Func<bool> canExecute)
|
||||||
{
|
{
|
||||||
this.execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
this.canExecute = canExecute;
|
_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<T> : ICommand
|
public class RelayCommand<T> : ICommand
|
||||||
{
|
{
|
||||||
private readonly Action<T> execute;
|
private readonly Action<T> execute;
|
||||||
@@ -48,10 +52,10 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
|||||||
this.canExecute = canExecute;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using Windows.ApplicationModel.Resources;
|
using Windows.ApplicationModel.Resources;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||||
|
|||||||
@@ -46,6 +46,9 @@
|
|||||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="..\..\codeAnalysis\GlobalSuppressions.cs">
|
||||||
|
<Link>GlobalSuppressions.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Activation\ActivationHandler.cs" />
|
<Compile Include="Activation\ActivationHandler.cs" />
|
||||||
<Compile Include="Activation\DefaultActivationHandler.cs" />
|
<Compile Include="Activation\DefaultActivationHandler.cs" />
|
||||||
<Compile Include="App.xaml.cs">
|
<Compile Include="App.xaml.cs">
|
||||||
@@ -56,7 +59,6 @@
|
|||||||
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
|
<Compile Include="Controls\HotkeySettingsControl.xaml.cs">
|
||||||
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
|
<DependentUpon>HotkeySettingsControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="GlobalSuppressions.cs" />
|
|
||||||
<Compile Include="Helpers\NavHelper.cs" />
|
<Compile Include="Helpers\NavHelper.cs" />
|
||||||
<Compile Include="Helpers\Observable.cs" />
|
<Compile Include="Helpers\Observable.cs" />
|
||||||
<Compile Include="Helpers\RelayCommand.cs" />
|
<Compile Include="Helpers\RelayCommand.cs" />
|
||||||
@@ -68,6 +70,7 @@
|
|||||||
<Compile Include="ViewModels\FancyZonesViewModel.cs" />
|
<Compile Include="ViewModels\FancyZonesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ImageResizerViewModel.cs" />
|
<Compile Include="ViewModels\ImageResizerViewModel.cs" />
|
||||||
<Compile Include="ViewModels\KeyboardManagerViewModel.cs" />
|
<Compile Include="ViewModels\KeyboardManagerViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\Keys.cs" />
|
||||||
<Compile Include="ViewModels\PowerRenameViewModel.cs" />
|
<Compile Include="ViewModels\PowerRenameViewModel.cs" />
|
||||||
<Compile Include="ViewModels\PowerLauncherViewModel.cs" />
|
<Compile Include="ViewModels\PowerLauncherViewModel.cs" />
|
||||||
<Compile Include="ViewModels\RemapKeysModel.cs" />
|
<Compile Include="ViewModels\RemapKeysModel.cs" />
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
using System.Reflection;
|
// Copyright (c) Microsoft Corporation
|
||||||
using System.Runtime.CompilerServices;
|
// 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;
|
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
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Microsoft.PowerToys.Settings.UI")]
|
[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:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// 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:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|||||||
@@ -34,33 +34,33 @@ namespace Microsoft.PowerToys.Settings.UI.Services
|
|||||||
|
|
||||||
public async Task ActivateAsync(object activationArgs)
|
public async Task ActivateAsync(object activationArgs)
|
||||||
{
|
{
|
||||||
if (this.IsInteractive(activationArgs))
|
if (IsInteractive(activationArgs))
|
||||||
{
|
{
|
||||||
// Initialize services that you need before app activation
|
// Initialize services that you need before app activation
|
||||||
// take into account that the splash screen is shown while this code runs.
|
// 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,
|
// Do not repeat app initialization when the Window already has content,
|
||||||
// just ensure that the window is active
|
// just ensure that the window is active
|
||||||
if (Window.Current.Content == null)
|
if (Window.Current.Content == null)
|
||||||
{
|
{
|
||||||
// Create a Shell or Frame to act as the navigation context
|
// 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
|
// Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler
|
||||||
// will navigate to the first page
|
// will navigate to the first page
|
||||||
await this.HandleActivationAsync(activationArgs);
|
await HandleActivationAsync(activationArgs);
|
||||||
this.lastActivationArgs = activationArgs;
|
lastActivationArgs = activationArgs;
|
||||||
|
|
||||||
if (this.IsInteractive(activationArgs))
|
if (IsInteractive(activationArgs))
|
||||||
{
|
{
|
||||||
// Ensure the current window is active
|
// Ensure the current window is active
|
||||||
Window.Current.Activate();
|
Window.Current.Activate();
|
||||||
|
|
||||||
// Tasks after activation
|
// Tasks after activation
|
||||||
await this.StartupAsync();
|
await StartupAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ namespace Microsoft.PowerToys.Settings.UI.Services
|
|||||||
|
|
||||||
private async Task HandleActivationAsync(object activationArgs)
|
private async Task HandleActivationAsync(object activationArgs)
|
||||||
{
|
{
|
||||||
var activationHandler = this.GetActivationHandlers()
|
var activationHandler = GetActivationHandlers()
|
||||||
.FirstOrDefault(h => h.CanHandle(activationArgs));
|
.FirstOrDefault(h => h.CanHandle(activationArgs));
|
||||||
|
|
||||||
if (activationHandler != null)
|
if (activationHandler != null)
|
||||||
@@ -79,9 +79,9 @@ namespace Microsoft.PowerToys.Settings.UI.Services
|
|||||||
await activationHandler.HandleAsync(activationArgs);
|
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))
|
if (defaultHandler.CanHandle(activationArgs))
|
||||||
{
|
{
|
||||||
await defaultHandler.HandleAsync(activationArgs);
|
await defaultHandler.HandleAsync(activationArgs);
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Keys.cs
Normal file
13
src/core/Microsoft.PowerToys.Settings.UI/ViewModels/Keys.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,45 +19,45 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
if (SettingsUtils.SettingsExists(POWERTOYNAME))
|
if (SettingsUtils.SettingsExists(POWERTOYNAME))
|
||||||
{
|
{
|
||||||
this.settings = SettingsUtils.GetSettings<PowerLauncherSettings>(POWERTOYNAME);
|
settings = SettingsUtils.GetSettings<PowerLauncherSettings>(POWERTOYNAME);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.settings = new PowerLauncherSettings();
|
settings = new PowerLauncherSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSettings([CallerMemberName] string propertyName = null)
|
private void UpdateSettings([CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
// Notify UI of property change
|
// Notify UI of property change
|
||||||
this.OnPropertyChanged(propertyName);
|
OnPropertyChanged(propertyName);
|
||||||
|
|
||||||
// Save settings to file
|
// Save settings to file
|
||||||
var options = new JsonSerializerOptions
|
var options = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
};
|
};
|
||||||
SettingsUtils.SaveSettings(JsonSerializer.Serialize(this.settings, options), POWERTOYNAME);
|
SettingsUtils.SaveSettings(JsonSerializer.Serialize(settings, options), POWERTOYNAME);
|
||||||
|
|
||||||
// Propagate changes to Power Launcher through IPC
|
// Propagate changes to Power Launcher through IPC
|
||||||
var propertiesJson = JsonSerializer.Serialize(this.settings.properties);
|
var propertiesJson = JsonSerializer.Serialize(settings.properties);
|
||||||
ShellPage.DefaultSndMSGCallback(
|
ShellPage.DefaultSndMSGCallback(
|
||||||
string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(this.settings.properties)));
|
string.Format("{{ \"{0}\": {1} }}", POWERTOYNAME, JsonSerializer.Serialize(settings.properties)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool EnablePowerLauncher
|
public bool EnablePowerLauncher
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.enable_powerlauncher;
|
return settings.properties.enable_powerlauncher;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.enable_powerlauncher != value)
|
if (settings.properties.enable_powerlauncher != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.enable_powerlauncher = value;
|
settings.properties.enable_powerlauncher = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,15 +66,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.search_result_preference;
|
return settings.properties.search_result_preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.search_result_preference != value)
|
if (settings.properties.search_result_preference != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.search_result_preference = value;
|
settings.properties.search_result_preference = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,15 +83,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.search_type_preference;
|
return settings.properties.search_type_preference;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.search_type_preference != value)
|
if (settings.properties.search_type_preference != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.search_type_preference = value;
|
settings.properties.search_type_preference = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,15 +100,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.maximum_number_of_results;
|
return settings.properties.maximum_number_of_results;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
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;
|
settings.properties.maximum_number_of_results = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,15 +117,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.open_powerlauncher;
|
return settings.properties.open_powerlauncher;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.open_powerlauncher != value)
|
if (settings.properties.open_powerlauncher != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.open_powerlauncher = value;
|
settings.properties.open_powerlauncher = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,15 +134,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.open_file_location;
|
return settings.properties.open_file_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.open_file_location != value)
|
if (settings.properties.open_file_location != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.open_file_location = value;
|
settings.properties.open_file_location = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,15 +151,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.copy_path_location;
|
return settings.properties.copy_path_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.copy_path_location != value)
|
if (settings.properties.copy_path_location != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.copy_path_location = value;
|
settings.properties.copy_path_location = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,15 +168,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.open_console;
|
return settings.properties.open_console;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.settings.properties.open_console != value)
|
if (settings.properties.open_console != value)
|
||||||
{
|
{
|
||||||
this.settings.properties.open_console = value;
|
settings.properties.open_console = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,15 +185,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.override_win_r_key;
|
return settings.properties.override_win_r_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
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;
|
settings.properties.override_win_r_key = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,15 +202,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.settings.properties.override_win_s_key;
|
return settings.properties.override_win_s_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
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;
|
settings.properties.override_win_s_key = value;
|
||||||
this.UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,30 +2,23 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||||
{
|
{
|
||||||
// Dummy data model for the UI. Will be removed moving forward.
|
// Dummy data model for the UI. Will be removed moving forward.
|
||||||
public class RemapKeysModel : ObservableCollection<Keys>
|
public class RemapKeysModel : ObservableCollection<Keys>
|
||||||
{
|
{
|
||||||
public RemapKeysModel()
|
public RemapKeysModel()
|
||||||
{
|
{
|
||||||
this.Add(new Keys { From = "A", To = "B" });
|
Add(new Keys { From = "A", To = "B" });
|
||||||
this.Add(new Keys { From = "B", To = "A" });
|
Add(new Keys { From = "B", To = "A" });
|
||||||
this.Add(new Keys { From = "Ctrl", To = "Shift" });
|
Add(new Keys { From = "Ctrl", To = "Shift" });
|
||||||
this.Add(new Keys { From = "Shift", To = "Ctrl" });
|
Add(new Keys { From = "Shift", To = "Ctrl" });
|
||||||
this.Add(new Keys { From = "A", To = "B" });
|
Add(new Keys { From = "A", To = "B" });
|
||||||
this.Add(new Keys { From = "B", To = "B" });
|
Add(new Keys { From = "B", To = "B" });
|
||||||
this.Add(new Keys { From = "Ctrl", To = "Shift" });
|
Add(new Keys { From = "Ctrl", To = "Shift" });
|
||||||
this.Add(new Keys { From = "Shift", To = "Ctrl" });
|
Add(new Keys { From = "Shift", To = "Ctrl" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class Keys
|
|
||||||
{
|
|
||||||
public string From { get; set; }
|
|
||||||
|
|
||||||
public string To { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -32,19 +32,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public bool IsBackEnabled
|
public bool IsBackEnabled
|
||||||
{
|
{
|
||||||
get { return this.isBackEnabled; }
|
get { return isBackEnabled; }
|
||||||
set { this.Set(ref this.isBackEnabled, value); }
|
set { Set(ref isBackEnabled, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public WinUI.NavigationViewItem Selected
|
public WinUI.NavigationViewItem Selected
|
||||||
{
|
{
|
||||||
get { return this.selected; }
|
get { return selected; }
|
||||||
set { this.Set(ref this.selected, value); }
|
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<WinUI.NavigationViewItemInvokedEventArgs>(this.OnItemInvoked));
|
public ICommand ItemInvokedCommand => itemInvokedCommand ?? (itemInvokedCommand = new RelayCommand<WinUI.NavigationViewItemInvokedEventArgs>(OnItemInvoked));
|
||||||
|
|
||||||
public ShellViewModel()
|
public ShellViewModel()
|
||||||
{
|
{
|
||||||
@@ -55,9 +55,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
this.navigationView = navigationView;
|
this.navigationView = navigationView;
|
||||||
this.keyboardAccelerators = keyboardAccelerators;
|
this.keyboardAccelerators = keyboardAccelerators;
|
||||||
NavigationService.Frame = frame;
|
NavigationService.Frame = frame;
|
||||||
NavigationService.NavigationFailed += this.Frame_NavigationFailed;
|
NavigationService.NavigationFailed += Frame_NavigationFailed;
|
||||||
NavigationService.Navigated += this.Frame_Navigated;
|
NavigationService.Navigated += Frame_Navigated;
|
||||||
this.navigationView.BackRequested += this.OnBackRequested;
|
this.navigationView.BackRequested += OnBackRequested;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
|
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.
|
// 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
|
// More info on tracking issue https://github.com/Microsoft/microsoft-ui-xaml/issues/8
|
||||||
this.keyboardAccelerators.Add(this.altLeftKeyboardAccelerator);
|
keyboardAccelerators.Add(altLeftKeyboardAccelerator);
|
||||||
this.keyboardAccelerators.Add(this.backKeyboardAccelerator);
|
keyboardAccelerators.Add(backKeyboardAccelerator);
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnItemInvoked(WinUI.NavigationViewItemInvokedEventArgs args)
|
private void OnItemInvoked(WinUI.NavigationViewItemInvokedEventArgs args)
|
||||||
{
|
{
|
||||||
var item = this.navigationView.MenuItems
|
var item = navigationView.MenuItems
|
||||||
.OfType<WinUI.NavigationViewItem>()
|
.OfType<WinUI.NavigationViewItem>()
|
||||||
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
|
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
|
||||||
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
|
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)
|
private void Frame_Navigated(object sender, NavigationEventArgs e)
|
||||||
{
|
{
|
||||||
this.IsBackEnabled = NavigationService.CanGoBack;
|
IsBackEnabled = NavigationService.CanGoBack;
|
||||||
this.Selected = this.navigationView.MenuItems
|
Selected = navigationView.MenuItems
|
||||||
.OfType<WinUI.NavigationViewItem>()
|
.OfType<WinUI.NavigationViewItem>()
|
||||||
.FirstOrDefault(menuItem => this.IsMenuItemForPageType(menuItem, e.SourcePageType));
|
.FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsMenuItemForPageType(WinUI.NavigationViewItem menuItem, Type sourcePageType)
|
private bool IsMenuItemForPageType(WinUI.NavigationViewItem menuItem, Type sourcePageType)
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,8 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// 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 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;
|
||||||
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
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||||
{
|
{
|
||||||
@@ -26,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
public FancyZonesPage()
|
public FancyZonesPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||||
using Windows.System;
|
using Windows.System;
|
||||||
using Windows.UI.Popups;
|
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Navigation;
|
using Windows.UI.Xaml.Navigation;
|
||||||
@@ -30,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public GeneralPage()
|
public GeneralPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -44,10 +42,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
|
||||||
// load and apply theme settings
|
// load and apply theme settings
|
||||||
this.ReLoadTheme(settings.theme);
|
ReLoadTheme(settings.theme);
|
||||||
|
|
||||||
// load run on start-up settings value and update the ui state.
|
// load run on start-up settings value and update the ui state.
|
||||||
this.ToggleSwitch_RunAtStartUp.IsOn = settings.startup;
|
ToggleSwitch_RunAtStartUp.IsOn = settings.startup;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -56,10 +54,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
|
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
|
||||||
|
|
||||||
// load and apply theme settings
|
// 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.
|
// 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":
|
case "light":
|
||||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||||
this.Radio_Theme_Light.IsChecked = true;
|
Radio_Theme_Light.IsChecked = true;
|
||||||
break;
|
break;
|
||||||
case "dark":
|
case "dark":
|
||||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||||
this.Radio_Theme_Dark.IsChecked = true;
|
Radio_Theme_Dark.IsChecked = true;
|
||||||
break;
|
break;
|
||||||
case "system":
|
case "system":
|
||||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||||
this.Radio_Theme_Default.IsChecked = true;
|
Radio_Theme_Default.IsChecked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +132,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (rb != null)
|
if (rb != null)
|
||||||
{
|
{
|
||||||
string themeName = rb.Tag.ToString();
|
string themeName = rb.Tag.ToString();
|
||||||
this.ReLoadTheme(themeName);
|
ReLoadTheme(themeName);
|
||||||
|
|
||||||
// update and save settings to file.
|
// update and save settings to file.
|
||||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
|||||||
@@ -2,32 +2,18 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// 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 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;
|
||||||
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
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||||
{
|
{
|
||||||
|
|
||||||
public sealed partial class ImageResizerPage : Page
|
public sealed partial class ImageResizerPage : Page
|
||||||
{
|
{
|
||||||
public ImageResizerViewModel ViewModel { get; } = new ImageResizerViewModel();
|
public ImageResizerViewModel ViewModel { get; } = new ImageResizerViewModel();
|
||||||
|
|
||||||
public ImageResizerPage()
|
public ImageResizerPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
public KeyboardManagerPage()
|
public KeyboardManagerPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,33 +18,33 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
public PowerLauncherPage()
|
public PowerLauncherPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
|
||||||
|
|
||||||
this.searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
searchResultPreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||||
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_AlphabeticalOrder"), "alphabetical_order"));
|
||||||
this.searchResultPreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_MostRecentlyUsed"), "most_recently_used"));
|
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.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchResultPreference_RunningProcessesOpenApplications"), "running_processes_open_applications"));
|
||||||
|
|
||||||
this.searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
searchTypePreferencesOptions = new ObservableCollection<Tuple<string, string>>();
|
||||||
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ApplicationName"), "application_name"));
|
||||||
this.searchTypePreferencesOptions.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_StringInApplication"), "string_in_application"));
|
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.Add(Tuple.Create(loader.GetString("PowerLauncher_SearchTypePreference_ExecutableName"), "executable_name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tuple<string, string> SelectedSearchResultPreference
|
public Tuple<string, string> SelectedSearchResultPreference
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.searchResultPreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchResultPreference);
|
return searchResultPreferencesOptions.First(item => item.Item2 == ViewModel.SearchResultPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
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
|
get
|
||||||
{
|
{
|
||||||
return this.searchTypePreferencesOptions.First(item => item.Item2 == this.ViewModel.SearchTypePreference);
|
return searchTypePreferencesOptions.First(item => item.Item2 == ViewModel.SearchTypePreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (this.ViewModel.SearchTypePreference != value.Item2)
|
if (ViewModel.SearchTypePreference != value.Item2)
|
||||||
{
|
{
|
||||||
this.ViewModel.SearchTypePreference = value.Item2;
|
ViewModel.SearchTypePreference = value.Item2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
|
||||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
@@ -15,11 +14,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class PowerPreviewPage : Page
|
public sealed partial class PowerPreviewPage : Page
|
||||||
{
|
{
|
||||||
private const string POWERTOY_NAME = "File Explorer Preview";
|
private const string PreviewPaneKey = "File Explorer Preview";
|
||||||
|
|
||||||
public PowerPreviewPage()
|
public PowerPreviewPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -29,16 +28,16 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
base.OnNavigatedTo(e);
|
base.OnNavigatedTo(e);
|
||||||
settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
|
settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||||
this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
|
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;
|
ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
settings = new PowerPreviewSettings(POWERTOY_NAME);
|
settings = new PowerPreviewSettings(PreviewPaneKey);
|
||||||
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOY_NAME);
|
SettingsUtils.SaveSettings(settings.ToJsonString(), PreviewPaneKey);
|
||||||
this.ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value;
|
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;
|
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)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
|
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||||
settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value = swt.IsOn;
|
settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
@@ -66,7 +65,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
if (swt != null)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(POWERTOY_NAME);
|
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||||
settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value = swt.IsOn;
|
settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
@@ -77,6 +76,5 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
public PowerRenamePage()
|
public PowerRenamePage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -31,23 +31,23 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
this.UpdateView(settings);
|
UpdateView(settings);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
settings = new PowerRenameSettings(POWERTOYNAME);
|
settings = new PowerRenameSettings(POWERTOYNAME);
|
||||||
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOYNAME);
|
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOYNAME);
|
||||||
this.UpdateView(settings);
|
UpdateView(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateView(PowerRenameSettings settings)
|
private void UpdateView(PowerRenameSettings settings)
|
||||||
{
|
{
|
||||||
this.Toggle_PowerRename_Enable.IsOn = settings.properties.bool_mru_enabled.value;
|
Toggle_PowerRename_Enable.IsOn = settings.properties.MruEnabled.value;
|
||||||
this.Toggle_PowerRename_EnableOnExtendedContextMenu.IsOn = settings.properties.bool_show_extended_menu.value;
|
Toggle_PowerRename_EnableOnExtendedContextMenu.IsOn = settings.properties.ShowExtendedMenu.value;
|
||||||
this.Toggle_PowerRename_MaxDispListNum.Value = settings.properties.int_max_mru_size.value;
|
Toggle_PowerRename_MaxDispListNum.Value = settings.properties.MaxMruSize.value;
|
||||||
this.Toggle_PowerRename_EnableOnContextMenu.IsOn = settings.properties.bool_show_icon_on_menu.value;
|
Toggle_PowerRename_EnableOnContextMenu.IsOn = settings.properties.ShowIconInMenu.value;
|
||||||
this.Toggle_PowerRename_RestoreFlagsOnLaunch.IsOn = settings.properties.bool_persist_input.value;
|
Toggle_PowerRename_RestoreFlagsOnLaunch.IsOn = settings.properties.PersistInput.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Toggle_PowerRename_Enable_Toggled(object sender, RoutedEventArgs e)
|
private void Toggle_PowerRename_Enable_Toggled(object sender, RoutedEventArgs e)
|
||||||
@@ -57,7 +57,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (swt != null)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
settings.properties.bool_mru_enabled.value = swt.IsOn;
|
settings.properties.MruEnabled.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (swt != null)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
settings.properties.bool_show_icon_on_menu.value = swt.IsOn;
|
settings.properties.ShowIconInMenu.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (swt != null)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
settings.properties.bool_show_extended_menu.value = swt.IsOn;
|
settings.properties.ShowExtendedMenu.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (swt != null)
|
if (swt != null)
|
||||||
{
|
{
|
||||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
settings.properties.bool_persist_input.value = swt.IsOn;
|
settings.properties.PersistInput.value = swt.IsOn;
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
if (sender != null)
|
if (sender != null)
|
||||||
{
|
{
|
||||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||||
settings.properties.int_max_mru_size.value = Convert.ToInt32(sender.Value);
|
settings.properties.MaxMruSize.value = Convert.ToInt32(sender.Value);
|
||||||
|
|
||||||
if (ShellPage.DefaultSndMSGCallback != null)
|
if (ShellPage.DefaultSndMSGCallback != null)
|
||||||
{
|
{
|
||||||
@@ -139,4 +139,3 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ShellPage()
|
public ShellPage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.DataContext = this.ViewModel;
|
DataContext = ViewModel;
|
||||||
ShellHandler = this;
|
ShellHandler = this;
|
||||||
this.ViewModel.Initialize(this.shellFrame, this.navigationView, this.KeyboardAccelerators);
|
ViewModel.Initialize(shellFrame, navigationView, KeyboardAccelerators);
|
||||||
this.shellFrame.Navigate(typeof(GeneralPage));
|
shellFrame.Navigate(typeof(GeneralPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
public ShortcutGuidePage()
|
public ShortcutGuidePage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,7 @@
|
|||||||
<Version>2.0.0-alpha0455</Version>
|
<Version>2.0.0-alpha0455</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="System.Text.Json">
|
<PackageReference Include="System.Text.Json">
|
||||||
<Version>4.7.0</Version>
|
<Version>4.7.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="StyleCop.Analyzers">
|
<PackageReference Include="StyleCop.Analyzers">
|
||||||
<Version>1.1.118</Version>
|
<Version>1.1.118</Version>
|
||||||
|
|||||||
Reference in New Issue
Block a user