mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Added Tests and Refactored code (#2129)
* Added Tests and Refactored code * removed un-used file * delete test files when test completes * removed extra build configs * added clean-up method * removed unused variable * re-added removed attributtion * added error handling and move strings to string resource * added error handling to file explorer view model * moved varible assignment to if statement block * removed savin of settings file from the UI * re-added open source notice * added missing controls for powerrename and fancy zones * removed dead coded * remove un-used configuration * added error handling for file saving and updated powerreanme constructor * removed added configurations * added settings state
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
<Compile Include="ViewModels\ImageResizerViewModel.cs" />
|
||||
<Compile Include="ViewModels\KeyboardManagerViewModel.cs" />
|
||||
<Compile Include="ViewModels\Keys.cs" />
|
||||
<Compile Include="ViewModels\PowerPreviewViewModel.cs" />
|
||||
<Compile Include="ViewModels\PowerRenameViewModel.cs" />
|
||||
<Compile Include="ViewModels\PowerLauncherViewModel.cs" />
|
||||
<Compile Include="ViewModels\RemapKeysModel.cs" />
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<comment>Navigation view item name for General</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerLauncher.Content" xml:space="preserve">
|
||||
<value>PowerLauncher</value>
|
||||
<value>PowerLauncher [Not Functional]</value>
|
||||
<comment>Navigation view item name for PowerLauncher</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerRename.Content" xml:space="preserve">
|
||||
@@ -142,7 +142,7 @@
|
||||
<comment>Navigation view item name for PowerRename</comment>
|
||||
</data>
|
||||
<data name="Shell_ShortcutGuide.Content" xml:space="preserve">
|
||||
<value>Shortcut Guide</value>
|
||||
<value>Shortcut Guide [Not Functional]</value>
|
||||
<comment>Navigation view item name for Shortcut Guide</comment>
|
||||
</data>
|
||||
<data name="Shell_PowerPreview.Content" xml:space="preserve">
|
||||
@@ -154,7 +154,7 @@
|
||||
<comment>Navigation view item name for FancyZones</comment>
|
||||
</data>
|
||||
<data name="Shell_ImageResizer.Content" xml:space="preserve">
|
||||
<value>Image Resizer</value>
|
||||
<value>Image Resizer [Not Functional]</value>
|
||||
<comment>Navigation view item name for Image Resizer</comment>
|
||||
</data>
|
||||
<data name="Shell_KeyboardManager.Content" xml:space="preserve">
|
||||
@@ -290,8 +290,8 @@
|
||||
<data name="FancyZones_OverrideSnapHotkeysCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Override Windows Snap hotkeys (Win + arrow) to move windows between zones</value>
|
||||
</data>
|
||||
<data name="FancyZones_SaveColorChoice.Content" xml:space="preserve">
|
||||
<value>Save Color Choice</value>
|
||||
<data name="FancyZones_SaveZoneHighlightColor.Content" xml:space="preserve">
|
||||
<value>Save Zone Highlight Color Choice</value>
|
||||
</data>
|
||||
<data name="FancyZones_ShiftDragCheckBoxControl_Header.Content" xml:space="preserve">
|
||||
<value>Hold Shift key or any non-primary mouse button to enable zones while dragging</value>
|
||||
@@ -320,4 +320,94 @@
|
||||
<data name="Module_overview.Content" xml:space="preserve">
|
||||
<value>Module overview</value>
|
||||
</data>
|
||||
<data name="AttributionTitle.Text" xml:space="preserve">
|
||||
<value>Attribution</value>
|
||||
</data>
|
||||
<data name="GeneralPage_AboutPowerToysHeader.Text" xml:space="preserve">
|
||||
<value>About PowerToys</value>
|
||||
</data>
|
||||
<data name="GeneralPage_CheckForUpdates.Content" xml:space="preserve">
|
||||
<value>Check for updates</value>
|
||||
</data>
|
||||
<data name="GeneralPage_PrivacyStatement_URL.Content" xml:space="preserve">
|
||||
<value>Privacy statement</value>
|
||||
</data>
|
||||
<data name="GeneralPage_Radio_Theme_Dark.Content" xml:space="preserve">
|
||||
<value>Dark</value>
|
||||
</data>
|
||||
<data name="GeneralPage_Radio_Theme_Default.Content" xml:space="preserve">
|
||||
<value>System default</value>
|
||||
</data>
|
||||
<data name="GeneralPage_Radio_Theme_Light.Content" xml:space="preserve">
|
||||
<value>Light</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ReportAbug.Content" xml:space="preserve">
|
||||
<value>Report a bug</value>
|
||||
</data>
|
||||
<data name="GeneralPage_RequestAFeature_URL.Content" xml:space="preserve">
|
||||
<value>Request a feature</value>
|
||||
</data>
|
||||
<data name="GeneralPage_RestartAsAdmin_Button.Content" xml:space="preserve">
|
||||
<value>Restart as admin</value>
|
||||
</data>
|
||||
<data name="GeneralPage_ToggleSwitch_RunAtStartUp.Header" xml:space="preserve">
|
||||
<value>Run at startup</value>
|
||||
</data>
|
||||
<data name="MiscellaneousTextBlockTitle.Text" xml:space="preserve">
|
||||
<value>Miscellaneous</value>
|
||||
</data>
|
||||
<data name="PowerRename_Description.Text" xml:space="preserve">
|
||||
<value>A Windows Shell Extension for more advanced bulk renaming using search and replace or regular expressions.</value>
|
||||
</data>
|
||||
<data name="PowerRename_ShellIntergration.Text" xml:space="preserve">
|
||||
<value>Shell integration</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_Enable.Header" xml:space="preserve">
|
||||
<value>Enable PowerRename</value>
|
||||
</data>
|
||||
<data name="RadioButtons_Name_Theme.Header" xml:space="preserve">
|
||||
<value>Theme</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_EnableOnContextMenu.Header" xml:space="preserve">
|
||||
<value>Show on default context menu</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_EnableOnExtendedContextMenu.Header" xml:space="preserve">
|
||||
<value>Only show on extended context menu (Shift + Right-click)</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_MaxDispListNum.Text" xml:space="preserve">
|
||||
<value>Maximum numbers of items to show in recently used list</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_RestoreFlagsOnLaunch.Header" xml:space="preserve">
|
||||
<value>Restore search, replace and flags values on launch from previous run</value>
|
||||
</data>
|
||||
<data name="FileEplorerPreview_ToggleSwitch_Preview_MD.Header" xml:space="preserve">
|
||||
<value>Markdown Preview Handler</value>
|
||||
</data>
|
||||
<data name="FileEplorerPreview_ToggleSwitch_Preview_SVG.Header" xml:space="preserve">
|
||||
<value>Svg Preview Handler</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Description.Text" xml:space="preserve">
|
||||
<value>These settings allow you to manage your Windows File Explorer custom preview handlers.</value>
|
||||
</data>
|
||||
<data name="Miscellaneous.Text" xml:space="preserve">
|
||||
<value>Miscellaneous</value>
|
||||
</data>
|
||||
<data name="OpenSource_Notice.Content" xml:space="preserve">
|
||||
<value>Open-source notice</value>
|
||||
</data>
|
||||
<data name="PowerRename_Toggle_AutoComplete.Header" xml:space="preserve">
|
||||
<value>Enable Auto Complete</value>
|
||||
</data>
|
||||
<data name="FancyZones_BorderColor.Text" xml:space="preserve">
|
||||
<value>Zone border color (Default #FFFFFF)</value>
|
||||
</data>
|
||||
<data name="FancyZones_InActiveColor.Text" xml:space="preserve">
|
||||
<value>Zone inactive color (Default #F5FCFF)</value>
|
||||
</data>
|
||||
<data name="FancyZones_SaveBorderColor.Content" xml:space="preserve">
|
||||
<value>Save Zone Border Color Choice</value>
|
||||
</data>
|
||||
<data name="FancyZones_SaveZoneInActiveColor.Content" xml:space="preserve">
|
||||
<value>Save Zone Inactive Color Choice</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -20,11 +20,27 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public ButtonClickCommand LaunchEditorEventHandler { get; set; }
|
||||
|
||||
public ICommand SaveColorChoiceEventHandler
|
||||
public ICommand SaveZoneHighlightColorEventHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<Color>(SaveColorChoice);
|
||||
return new RelayCommand<Color>(SaveZoneHighlightColor);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand SaveBorderColorEventHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<Color>(SaveZoneBorderColor);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand SaveInActiveColorEventHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<Color>(SaveZoneInActiveColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +48,17 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
public FancyZonesViewModel()
|
||||
{
|
||||
Settings = SettingsUtils.GetSettings<FancyZonesSettings>(ModuleName);
|
||||
try
|
||||
{
|
||||
Settings = SettingsUtils.GetSettings<FancyZonesSettings>(ModuleName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Settings = new FancyZonesSettings();
|
||||
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
|
||||
}
|
||||
|
||||
this.LaunchEditorEventHandler = new ButtonClickCommand(LaunchEditor);
|
||||
// this.SaveColorChoiceEventHandler = new ButtonClickCommand(SaveColorChoice);
|
||||
|
||||
this._shiftDrag = Settings.Properties.FancyzonesShiftDrag.Value;
|
||||
this._overrideSnapHotkeys = Settings.Properties.FancyzonesOverrideSnapHotkeys.Value;
|
||||
@@ -49,8 +73,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
|
||||
this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
|
||||
this._editorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value;
|
||||
this._zoneBorderColor = Settings.Properties.FancyzonesBorderColor.Value;
|
||||
this._zoneInActiveColor = Settings.Properties.FancyzonesInActiveColor.Value;
|
||||
|
||||
GeneralSettings generalSettings;
|
||||
try
|
||||
{
|
||||
generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty);
|
||||
}
|
||||
|
||||
GeneralSettings generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
this._isEnabled = generalSettings.Enabled.FancyZones;
|
||||
}
|
||||
|
||||
@@ -68,6 +104,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private int _highlightOpacity;
|
||||
private string _excludedApps;
|
||||
private HotkeySettings _editorHotkey;
|
||||
private string _zoneBorderColor;
|
||||
private string _zoneInActiveColor;
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
@@ -271,6 +309,42 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string ZoneBorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _zoneBorderColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _zoneBorderColor)
|
||||
{
|
||||
_zoneBorderColor = value;
|
||||
Settings.Properties.FancyzonesBorderColor.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ZoneInActiveColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _zoneInActiveColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _zoneInActiveColor)
|
||||
{
|
||||
_zoneInActiveColor = value;
|
||||
Settings.Properties.FancyzonesInActiveColor.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int HighlightOpacity
|
||||
{
|
||||
get
|
||||
@@ -351,11 +425,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
ShellPage.DefaultSndMSGCallback("{\"action\":{\"FancyZones\":{\"action_name\":\"ToggledFZEditor\", \"value\":\"\"}}}");
|
||||
}
|
||||
|
||||
private void SaveColorChoice(Color color)
|
||||
private void SaveZoneHighlightColor(Color color)
|
||||
{
|
||||
ZoneHighlightColor = color.ToString();
|
||||
}
|
||||
|
||||
private void SaveZoneBorderColor(Color color)
|
||||
{
|
||||
ZoneBorderColor = color.ToString();
|
||||
}
|
||||
|
||||
private void SaveZoneInActiveColor(Color color)
|
||||
{
|
||||
ZoneInActiveColor = color.ToString();
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
@@ -2,14 +2,225 @@
|
||||
// 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.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels.Commands;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Windows.System;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class GeneralViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfigs { get; set; }
|
||||
|
||||
public ButtonClickCommand CheckFoUpdatesEventHandler { get; set; }
|
||||
|
||||
public ButtonClickCommand RestartElevatedButtonEventHandler { get; set; }
|
||||
|
||||
public GeneralViewModel()
|
||||
{
|
||||
this.CheckFoUpdatesEventHandler = new ButtonClickCommand(CheckForUpdates_Click);
|
||||
this.RestartElevatedButtonEventHandler = new ButtonClickCommand(Restart_Elevated);
|
||||
|
||||
try
|
||||
{
|
||||
GeneralSettingsConfigs = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
GeneralSettingsConfigs = new GeneralSettings();
|
||||
SettingsUtils.SaveSettings(GeneralSettingsConfigs.ToJsonString(), string.Empty);
|
||||
}
|
||||
|
||||
switch (GeneralSettingsConfigs.Theme.ToLower())
|
||||
{
|
||||
case "light":
|
||||
_isLightThemeRadioButtonChecked = true;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||
break;
|
||||
case "dark":
|
||||
_isDarkThemeRadioButtonChecked = true;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||
break;
|
||||
case "system":
|
||||
_isSystemThemeRadioButtonChecked = true;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||
break;
|
||||
}
|
||||
|
||||
_startup = GeneralSettingsConfigs.Startup;
|
||||
}
|
||||
|
||||
private bool _packaged = false;
|
||||
private bool _startup = false;
|
||||
private bool _isElevated = false;
|
||||
private bool _runElevated = false;
|
||||
private bool _isDarkThemeRadioButtonChecked = false;
|
||||
private bool _isLightThemeRadioButtonChecked = false;
|
||||
private bool _isSystemThemeRadioButtonChecked = false;
|
||||
|
||||
// Gets or sets a value indicating whether packaged.
|
||||
public bool Packaged
|
||||
{
|
||||
get
|
||||
{
|
||||
return _packaged;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_packaged != value)
|
||||
{
|
||||
_packaged = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gets or sets a value indicating whether run powertoys on start-up.
|
||||
public bool Startup
|
||||
{
|
||||
get
|
||||
{
|
||||
return _startup;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_startup != value)
|
||||
{
|
||||
_startup = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gets or sets a value indicating whether the powertoy elevated.
|
||||
public bool IsElevated
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isElevated;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_isElevated != value)
|
||||
{
|
||||
_isElevated = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gets or sets a value indicating whether powertoys should run elevated.
|
||||
public bool RunElevated
|
||||
{
|
||||
get
|
||||
{
|
||||
return _runElevated;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_runElevated != value)
|
||||
{
|
||||
_runElevated = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDarkThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isDarkThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
GeneralSettingsConfigs.Theme = "dark";
|
||||
_isDarkThemeRadioButtonChecked = value;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLightThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isLightThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
GeneralSettingsConfigs.Theme = "light";
|
||||
_isLightThemeRadioButtonChecked = value;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSystemThemeRadioButtonChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSystemThemeRadioButtonChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
GeneralSettingsConfigs.Theme = "system";
|
||||
_isSystemThemeRadioButtonChecked = value;
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(GeneralSettingsConfigs);
|
||||
|
||||
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
|
||||
}
|
||||
|
||||
// callback function to launch the URL to check for updates.
|
||||
private async void CheckForUpdates_Click()
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri("https://github.com/microsoft/PowerToys/releases"));
|
||||
}
|
||||
|
||||
private void Restart_Elevated()
|
||||
{
|
||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
settings.RunElevated = true;
|
||||
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// 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.Runtime.CompilerServices;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerPreviewViewModel : Observable
|
||||
{
|
||||
private const string ModuleName = "File Explorer Preview";
|
||||
|
||||
private PowerPreviewSettings Settings { get; set; }
|
||||
|
||||
public PowerPreviewViewModel()
|
||||
{
|
||||
try
|
||||
{
|
||||
Settings = SettingsUtils.GetSettings<PowerPreviewSettings>(ModuleName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Settings = new PowerPreviewSettings();
|
||||
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
|
||||
}
|
||||
|
||||
this._svgRenderIsEnabled = Settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value;
|
||||
this._mdRenderIsEnabled = Settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value;
|
||||
}
|
||||
|
||||
private bool _svgRenderIsEnabled = false;
|
||||
private bool _mdRenderIsEnabled = false;
|
||||
|
||||
public bool SVGRenderIsEnebled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _svgRenderIsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _svgRenderIsEnabled)
|
||||
{
|
||||
_svgRenderIsEnabled = value;
|
||||
Settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MDRenderIsEnebled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mdRenderIsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _mdRenderIsEnabled)
|
||||
{
|
||||
_mdRenderIsEnabled = value;
|
||||
Settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerPreviewSettings snd = new SndPowerPreviewSettings(Settings);
|
||||
SndModuleSettings<SndPowerPreviewSettings> ipcMessage = new SndModuleSettings<SndPowerPreviewSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,186 @@
|
||||
// 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.Runtime.CompilerServices;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class PowerRenameViewModel : Observable
|
||||
{
|
||||
private const string ModuleName = "PowerRename";
|
||||
|
||||
private PowerRenameSettings Settings { get; set; }
|
||||
|
||||
public PowerRenameViewModel()
|
||||
{
|
||||
try
|
||||
{
|
||||
PowerRenameLocalProperties localSettings = SettingsUtils.GetSettings<PowerRenameLocalProperties>(ModuleName, "power-rename-settings.json");
|
||||
Settings = new PowerRenameSettings(localSettings);
|
||||
}
|
||||
catch
|
||||
{
|
||||
PowerRenameLocalProperties localSettings = new PowerRenameLocalProperties();
|
||||
Settings = new PowerRenameSettings(localSettings);
|
||||
SettingsUtils.SaveSettings(localSettings.ToJsonString(), ModuleName, "power-rename-settings.json");
|
||||
}
|
||||
|
||||
_powerRenameEnabledOnContextMenu = Settings.properties.ShowIcon.Value;
|
||||
_powerRenameEnabledOnContextExtendedMenu = Settings.properties.ExtendedContextMenuOnly.Value;
|
||||
_powerRenameRestoreFlagsOnLaunch = Settings.properties.PersistState.Value;
|
||||
_powerRenameMaxDispListNumValue = Settings.properties.MaxMRUSize.Value;
|
||||
_autoComplete = Settings.properties.MRUEnabled.Value;
|
||||
|
||||
GeneralSettings generalSettings;
|
||||
try
|
||||
{
|
||||
generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
generalSettings = new GeneralSettings();
|
||||
SettingsUtils.SaveSettings(generalSettings.ToJsonString(), string.Empty);
|
||||
}
|
||||
|
||||
_powerRenameEnabled = generalSettings.Enabled.PowerRename;
|
||||
}
|
||||
|
||||
private bool _powerRenameEnabled = false;
|
||||
private bool _powerRenameEnabledOnContextMenu = false;
|
||||
private bool _powerRenameEnabledOnContextExtendedMenu = false;
|
||||
private bool _powerRenameRestoreFlagsOnLaunch = false;
|
||||
private int _powerRenameMaxDispListNumValue = 0;
|
||||
private bool _autoComplete = false;
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerRenameEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _powerRenameEnabled)
|
||||
{
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
GeneralSettings generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
generalSettings.Enabled.PowerRename = value;
|
||||
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(generalSettings);
|
||||
ShellPage.DefaultSndMSGCallback(snd.ToString());
|
||||
|
||||
_powerRenameEnabled = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MRUEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _autoComplete;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _autoComplete)
|
||||
{
|
||||
_autoComplete = value;
|
||||
Settings.properties.MRUEnabled.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnabledOnContextMenu
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerRenameEnabledOnContextMenu;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _powerRenameEnabledOnContextMenu)
|
||||
{
|
||||
_powerRenameEnabledOnContextMenu = value;
|
||||
Settings.properties.ShowIcon.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnabledOnContextExtendedMenu
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerRenameEnabledOnContextExtendedMenu;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _powerRenameEnabledOnContextExtendedMenu)
|
||||
{
|
||||
_powerRenameEnabledOnContextExtendedMenu = value;
|
||||
Settings.properties.ExtendedContextMenuOnly.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RestoreFlagsOnLaunch
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerRenameRestoreFlagsOnLaunch;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _powerRenameRestoreFlagsOnLaunch)
|
||||
{
|
||||
_powerRenameRestoreFlagsOnLaunch = value;
|
||||
Settings.properties.PersistState.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxDispListNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return _powerRenameMaxDispListNumValue;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _powerRenameMaxDispListNumValue)
|
||||
{
|
||||
_powerRenameMaxDispListNumValue = value;
|
||||
Settings.properties.MaxMRUSize.Value = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
// Notify UI of property change
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(Settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,12 +130,12 @@
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
|
||||
|
||||
<TextBlock x:Uid="FancyZones_ZoneHighlightColor"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
|
||||
<muxc:ColorPicker x:Name="ColorChoice"
|
||||
<muxc:ColorPicker x:Name="FancyZones_ZoneHighlightColor"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsMoreButtonVisible="True"
|
||||
@@ -146,15 +146,66 @@
|
||||
IsAlphaSliderVisible="True"
|
||||
IsAlphaTextInputVisible="True"
|
||||
Color="{Binding Path=ZoneHighlightColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
DataContext="{Binding ZoneHighlightColor, Source={StaticResource eventViewModel}}"/>
|
||||
|
||||
<Button x:Uid="FancyZones_SaveColorChoice"
|
||||
<Button x:Uid="FancyZones_SaveZoneHighlightColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{Binding SaveColorChoiceEventHandler, Source={StaticResource eventViewModel}}"
|
||||
CommandParameter="{Binding Color, ElementName=ColorChoice}"
|
||||
Command = "{Binding SaveZoneHighlightColorEventHandler, Source={StaticResource eventViewModel}}"
|
||||
CommandParameter="{Binding Color, ElementName=FancyZones_ZoneHighlightColor}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_InActiveColor"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
|
||||
<muxc:ColorPicker x:Name="FancyZones_InActiveColor"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsMoreButtonVisible="True"
|
||||
IsColorSliderVisible="True"
|
||||
IsColorChannelTextInputVisible="True"
|
||||
IsHexInputVisible="True"
|
||||
IsAlphaEnabled="True"
|
||||
IsAlphaSliderVisible="True"
|
||||
IsAlphaTextInputVisible="True"
|
||||
Color="{Binding Path=ZoneInActiveColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
DataContext="{Binding ZoneInActiveColor, Source={StaticResource eventViewModel}}"/>
|
||||
|
||||
<Button x:Uid="FancyZones_SaveZoneInActiveColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{Binding SaveInActiveColorEventHandler, Source={StaticResource eventViewModel}}"
|
||||
CommandParameter="{Binding Color, ElementName=FancyZones_InActiveColor}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_BorderColor"
|
||||
Style="{StaticResource BodyTextBlockStyle}"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
|
||||
<muxc:ColorPicker x:Name="FancyZones_BorderColor"
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsMoreButtonVisible="True"
|
||||
IsColorSliderVisible="True"
|
||||
IsColorChannelTextInputVisible="True"
|
||||
IsHexInputVisible="True"
|
||||
IsAlphaEnabled="True"
|
||||
IsAlphaSliderVisible="True"
|
||||
IsAlphaTextInputVisible="True"
|
||||
Color="{Binding Path=ZoneBorderColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
DataContext="{Binding ZoneBorderColor, Source={StaticResource eventViewModel}}"/>
|
||||
|
||||
<Button x:Uid="FancyZones_SaveBorderColor"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{Binding SaveBorderColorEventHandler, Source={StaticResource eventViewModel}}"
|
||||
CommandParameter="{Binding Color, ElementName=FancyZones_BorderColor}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||
|
||||
<TextBlock x:Uid="FancyZones_ExcludeApps"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
<Page
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.GeneralPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
|
||||
xmlns:viewModel="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Page.Resources>
|
||||
<viewModel:GeneralViewModel x:Key="eventViewModel"/>
|
||||
</Page.Resources>
|
||||
|
||||
|
||||
<Grid ColumnSpacing="{StaticResource DefaultColumnSpacing}" RowSpacing="{StaticResource DefaultRowSpacing}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
@@ -40,76 +46,70 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<ToggleSwitch Header="Run at startup" x:Name="ToggleSwitch_RunAtStartUp" Margin="{StaticResource SmallTopMargin}" Toggled="ToggleSwitch_RunAtStartUp_Toggled" />
|
||||
<StackPanel Orientation="Vertical"
|
||||
x:Name="GeneralSettingsView">
|
||||
|
||||
<muxc:RadioButtons Header="Theme" Margin="{StaticResource MediumTopMargin}">
|
||||
<RadioButton x:Name="Radio_Theme_Dark" Content="Dark" Tag="Dark" Checked="Theme_Changed"/>
|
||||
<RadioButton x:Name="Radio_Theme_Light" Content="Light" Tag="Light" Checked="Theme_Changed"/>
|
||||
<RadioButton x:Name="Radio_Theme_Default" Content="System default" Tag="System" Checked="Theme_Changed"/>
|
||||
<ToggleSwitch x:Uid="GeneralPage_ToggleSwitch_RunAtStartUp"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=Startup}"/>
|
||||
|
||||
<muxc:RadioButtons x:Uid="RadioButtons_Name_Theme" Margin="{StaticResource SmallTopMargin}">
|
||||
<RadioButton x:Uid="GeneralPage_Radio_Theme_Dark"
|
||||
Content="Dark"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsDarkThemeRadioButtonChecked}"/>
|
||||
|
||||
<RadioButton x:Uid="GeneralPage_Radio_Theme_Light"
|
||||
Content="Light"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsLightThemeRadioButtonChecked}"/>
|
||||
|
||||
<RadioButton x:Uid="GeneralPage_Radio_Theme_Default"
|
||||
Content="System default"
|
||||
IsChecked="{ Binding Mode=TwoWay, Path=IsSystemThemeRadioButtonChecked}"/>
|
||||
</muxc:RadioButtons>
|
||||
|
||||
<!--
|
||||
<TextBlock Text="Default apps" Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
<ToggleSwitch Header="Disable telemetry" IsOn="True" Margin="0,14,0,0" />
|
||||
<TextBlock Text="PowerToys currently respects the Windows data & feedback setting" Opacity="0.8" Margin="0,0,0,0" />
|
||||
-->
|
||||
|
||||
<Button
|
||||
Content="Restart as admin"
|
||||
Margin="{StaticResource MediumTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Click="Restart_Elevated" />
|
||||
|
||||
<!--
|
||||
<TextBlock Text="Default apps" Style="{StaticResource SubtitleTextBlockStyle}" Margin="0,34,0,8"/>
|
||||
<ComboBox Header="Shell" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
||||
<ComboBoxItem>PowerShell</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<ComboBox Header="Terminal" SelectedIndex="0" MinWidth="240" Margin="0,14,0,0">
|
||||
<ComboBoxItem>Windows Console</ComboBoxItem>
|
||||
</ComboBox>
|
||||
-->
|
||||
<Button x:Uid="GeneralPage_RestartAsAdmin_Button"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Command = "{Binding RestartElevatedButtonEventHandler, Source={StaticResource eventViewModel}}"
|
||||
/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock
|
||||
Text="About PowerToys"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock
|
||||
Text="Version 0.15.2"
|
||||
FontWeight="Bold"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
<HyperlinkButton
|
||||
Content="Release notes"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/releases" />
|
||||
<Button
|
||||
Content="Check for updates"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Click="CheckForUpdates_Click" />
|
||||
<HyperlinkButton
|
||||
Content="Report a bug"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"
|
||||
Margin="{StaticResource MediumTopMargin}" />
|
||||
<HyperlinkButton
|
||||
Content="Request a feature"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||
<HyperlinkButton
|
||||
Content="Privacy statement"
|
||||
NavigateUri="http://go.microsoft.com/fwlink/?LinkId=521839" />
|
||||
<HyperlinkButton
|
||||
Content="Open-source notice"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/blob/master/NOTICE.md" />
|
||||
<TextBlock x:Uid="GeneralPage_AboutPowerToysHeader"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
|
||||
<TextBlock Text="Version 0.15.2"
|
||||
FontWeight="Bold"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
|
||||
<Button x:Uid="GeneralPage_CheckForUpdates"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Foreground="White"
|
||||
Command = "{Binding CheckFoUpdatesEventHandler, Source={StaticResource eventViewModel}}"
|
||||
/>
|
||||
|
||||
<HyperlinkButton x:Uid="GeneralPage_ReportAbug"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"
|
||||
Margin="{StaticResource SmallTopMargin}" />
|
||||
|
||||
<HyperlinkButton x:Uid="GeneralPage_RequestAFeature_URL"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||
|
||||
<HyperlinkButton x:Uid="GeneralPage_PrivacyStatement_URL"
|
||||
NavigateUri=" http://go.microsoft.com/fwlink/?LinkId=521839" />
|
||||
|
||||
<HyperlinkButton x:Uid="OpenSource_Notice"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/blob/master/NOTICE.md"
|
||||
/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.System;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
@@ -18,9 +20,9 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
public sealed partial class GeneralPage : Page
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets view model.
|
||||
/// Gets or sets view model.
|
||||
/// </summary>
|
||||
public GeneralViewModel ViewModel { get; } = new GeneralViewModel();
|
||||
public GeneralViewModel ViewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GeneralPage"/> class.
|
||||
@@ -28,122 +30,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
/// </summary>
|
||||
public GeneralPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
this.InitializeComponent();
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
GeneralSettings settings = null;
|
||||
try
|
||||
{
|
||||
// get settings file if they exist.
|
||||
settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
|
||||
// load and apply theme settings
|
||||
ReLoadTheme(settings.Theme);
|
||||
|
||||
// load run on start-up settings value and update the ui state.
|
||||
ToggleSwitch_RunAtStartUp.IsOn = settings.Startup;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// create settings file if one is not found.
|
||||
settings = new GeneralSettings();
|
||||
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
|
||||
|
||||
// load and apply theme settings
|
||||
ReLoadTheme(settings.Theme);
|
||||
|
||||
// load run on start up ui settings value and update the ui state.
|
||||
ToggleSwitch_RunAtStartUp.IsOn = settings.Startup;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update and save theme settings to json file.
|
||||
/// </summary>
|
||||
/// <param name="themeName">theme name.</param>
|
||||
private void ReLoadTheme(string themeName)
|
||||
{
|
||||
switch (themeName.ToLower())
|
||||
{
|
||||
case "light":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Light;
|
||||
Radio_Theme_Light.IsChecked = true;
|
||||
break;
|
||||
case "dark":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Dark;
|
||||
Radio_Theme_Dark.IsChecked = true;
|
||||
break;
|
||||
case "system":
|
||||
ShellPage.ShellHandler.RequestedTheme = ElementTheme.Default;
|
||||
Radio_Theme_Default.IsChecked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitch_RunAtStartUp_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
|
||||
string startup = swt.IsOn.ToString().ToLower();
|
||||
switch (startup)
|
||||
{
|
||||
case "true":
|
||||
settings.Startup = true;
|
||||
break;
|
||||
case "false":
|
||||
settings.Startup = false;
|
||||
break;
|
||||
}
|
||||
|
||||
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
|
||||
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Restart_Elevated(object sender, RoutedEventArgs e)
|
||||
{
|
||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
settings.RunElevated = true;
|
||||
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Theme_Changed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RadioButton rb = sender as RadioButton;
|
||||
|
||||
if (rb != null)
|
||||
{
|
||||
string themeName = rb.Tag.ToString();
|
||||
ReLoadTheme(themeName);
|
||||
|
||||
// update and save settings to file.
|
||||
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||
settings.Theme = themeName;
|
||||
SettingsUtils.SaveSettings(settings.ToJsonString(), string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private async void CheckForUpdates_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Launcher.LaunchUriAsync(new Uri("https://github.com/microsoft/PowerToys/releases"));
|
||||
this.ViewModel = new GeneralViewModel();
|
||||
this.GeneralSettingsView.DataContext = this.ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,40 +38,36 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="These settings allow you to manage your Windows File Explorer Addons."
|
||||
|
||||
<StackPanel Orientation="Vertical"
|
||||
x:Name="PowerPreviewSettingsView">
|
||||
<TextBlock x:Uid="FileExplorerPreview_Description"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<ToggleSwitch Header="Svg Preview Handler"
|
||||
x:Name="ToggleSwitch_Preview_SVG"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="ToggleSwitch_Preview_SVG_Toggled" />
|
||||
<ToggleSwitch x:Uid="FileEplorerPreview_ToggleSwitch_Preview_SVG"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=SVGRenderIsEnebled}" />
|
||||
|
||||
<ToggleSwitch Header="Markdown Preview Handler"
|
||||
x:Name="ToggleSwitch_Preview_MD"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="ToggleSwitch_Preview_MD_Toggled" />
|
||||
<ToggleSwitch x:Uid="FileEplorerPreview_ToggleSwitch_Preview_MD"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=MDRenderIsEnebled}" />
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
<StackPanel x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock
|
||||
Text="About this feature"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
<TextBlock x:Uid="About_This_Feature"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
|
||||
<HyperlinkButton
|
||||
Content="Module overview"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/tree/master/src/modules/previewpane"/>
|
||||
<HyperlinkButton
|
||||
Content="Give feedback"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||
<HyperlinkButton x:Uid="Module_overview"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/tree/master/src/modules/previewpane"/>
|
||||
|
||||
<HyperlinkButton x:Uid="Give_Feedback"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -2,7 +2,9 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
@@ -14,67 +16,13 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
/// </summary>
|
||||
public sealed partial class PowerPreviewPage : Page
|
||||
{
|
||||
private const string PreviewPaneKey = "File Explorer Preview";
|
||||
public PowerPreviewViewModel viewModel { get; set; }
|
||||
|
||||
public PowerPreviewPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
PowerPreviewSettings settings;
|
||||
try
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||
ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value;
|
||||
ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
settings = new PowerPreviewSettings(PreviewPaneKey);
|
||||
SettingsUtils.SaveSettings(settings.ToJsonString(), PreviewPaneKey);
|
||||
ToggleSwitch_Preview_SVG.IsOn = settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value;
|
||||
ToggleSwitch_Preview_MD.IsOn = settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitch_Preview_SVG_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||
settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerPreviewSettings snd = new SndPowerPreviewSettings(settings);
|
||||
SndModuleSettings<SndPowerPreviewSettings> ipcMessage = new SndModuleSettings<SndPowerPreviewSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitch_Preview_MD_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerPreviewSettings settings = SettingsUtils.GetSettings<PowerPreviewSettings>(PreviewPaneKey);
|
||||
settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerPreviewSettings snd = new SndPowerPreviewSettings(settings);
|
||||
SndModuleSettings<SndPowerPreviewSettings> ipcMessage = new SndModuleSettings<SndPowerPreviewSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
this.InitializeComponent();
|
||||
viewModel = new PowerPreviewViewModel();
|
||||
this.PowerPreviewSettingsView.DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,74 +39,81 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock Text="A Windows Shell Extension for more advanced bulk renaming using search and replace or regular expressions."
|
||||
<StackPanel Orientation="Vertical"
|
||||
x:Name="PowerRenameSettingsView">
|
||||
|
||||
<TextBlock x:Uid="PowerRename_Description"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<ToggleSwitch x:Name="Toggle_PowerRename_Enable"
|
||||
Header="Enable PowerRename"
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_Enable"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="Toggle_PowerRename_Enable_Toggled"
|
||||
IsOn="{Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="Shell integration"
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_AutoComplete"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
IsOn="{Binding Mode=TwoWay, Path=MRUEnabled}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock x:Uid="PowerRename_ShellIntergration"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
<ToggleSwitch x:Name="Toggle_PowerRename_EnableOnContextMenu"
|
||||
Header="Show on default context menu"
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnContextMenu"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="Toggle_PowerRename_EnableOnContextMenu_Toggled"
|
||||
IsOn="{Binding Mode=TwoWay, Path=EnabledOnContextMenu}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
|
||||
<ToggleSwitch x:Name="Toggle_PowerRename_EnableOnExtendedContextMenu"
|
||||
Header="Only show on extended context menu (Shift + Right-click)"
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_EnableOnExtendedContextMenu"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="Toggle_PowerRename_EnableOnExtendedContextMenu_Toggled"
|
||||
IsOn="{Binding Mode=TwoWay, Path=EnabledOnContextExtendedMenu}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
|
||||
<TextBlock Text="Miscellaneous"
|
||||
<TextBlock x:Uid="Miscellaneous"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||
|
||||
<ToggleSwitch x:Name="Toggle_PowerRename_RestoreFlagsOnLaunch"
|
||||
Header="Restore search, replace and flags values on launch from previous run"
|
||||
<ToggleSwitch x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
Toggled="Toggle_PowerRename_RestoreFlagsOnLaunch_Toggled"
|
||||
IsOn="{Binding Mode=TwoWay, Path=RestoreFlagsOnLaunch}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
|
||||
<muxc:NumberBox x:Name="Toggle_PowerRename_MaxDispListNum"
|
||||
Header="Maximum numbers of items to show in recently used list"
|
||||
<muxc:NumberBox x:Name="PowerRename_Toggle_MaxDispListNum"
|
||||
SpinButtonPlacementMode="Inline"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="{StaticResource SmallTopMargin}"
|
||||
ValueChanged="Toggle_PowerRename_MaxDispListNum_ValueChanged"
|
||||
Value="{Binding Mode=TwoWay, Path=MaxDispListNum}"
|
||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<StackPanel
|
||||
x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
|
||||
|
||||
<StackPanel x:Name="SidePanel"
|
||||
Orientation="Vertical"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{StaticResource SidePanelWidth}"
|
||||
Grid.Column="1">
|
||||
|
||||
<TextBlock x:Uid="About_This_Feature"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
|
||||
<HyperlinkButton x:Uid="Module_overview"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/tree/master/src/modules/powerrename"/>
|
||||
|
||||
<HyperlinkButton x:Uid="Give_Feedback"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/issues"/>
|
||||
|
||||
|
||||
<TextBlock
|
||||
Text="About this feature"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}"
|
||||
Margin="{StaticResource XSmallBottomMargin}"/>
|
||||
|
||||
<HyperlinkButton
|
||||
Content="Module overview"
|
||||
NavigateUri="https://github.com/microsoft/PowerToys/tree/master/src/modules/powerrename"/>
|
||||
|
||||
<TextBlock
|
||||
Text="Attribution"
|
||||
x:Uid="AttributionTitle"
|
||||
Style="{StaticResource SettingsGroupTitleStyle}" />
|
||||
|
||||
<HyperlinkButton
|
||||
Content="Chris Davis's SmartRenamer"
|
||||
NavigateUri="https://github.com/chrdavis/SmartRename" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -14,128 +14,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class PowerRenamePage : Page
|
||||
{
|
||||
public PowerRenameViewModel ViewModel { get; } = new PowerRenameViewModel();
|
||||
|
||||
private const string POWERTOYNAME = "PowerRename";
|
||||
public PowerRenameViewModel ViewModel { get; set; }
|
||||
|
||||
public PowerRenamePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
this.InitializeComponent();
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
PowerRenameSettings settings;
|
||||
try
|
||||
{
|
||||
settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
UpdateView(settings);
|
||||
}
|
||||
catch
|
||||
{
|
||||
settings = new PowerRenameSettings(POWERTOYNAME);
|
||||
SettingsUtils.SaveSettings(settings.ToJsonString(), POWERTOYNAME);
|
||||
UpdateView(settings);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateView(PowerRenameSettings settings)
|
||||
{
|
||||
Toggle_PowerRename_Enable.IsOn = settings.properties.MruEnabled.Value;
|
||||
Toggle_PowerRename_EnableOnExtendedContextMenu.IsOn = settings.properties.ShowExtendedMenu.Value;
|
||||
Toggle_PowerRename_MaxDispListNum.Value = settings.properties.MaxMruSize.Value;
|
||||
Toggle_PowerRename_EnableOnContextMenu.IsOn = settings.properties.ShowIconInMenu.Value;
|
||||
Toggle_PowerRename_RestoreFlagsOnLaunch.IsOn = settings.properties.PersistInput.Value;
|
||||
}
|
||||
|
||||
private void Toggle_PowerRename_Enable_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
settings.properties.MruEnabled.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Toggle_PowerRename_EnableOnContextMenu_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
settings.properties.ShowIconInMenu.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Toggle_PowerRename_EnableOnExtendedContextMenu_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
settings.properties.ShowExtendedMenu.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Toggle_PowerRename_RestoreFlagsOnLaunch_Toggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ToggleSwitch swt = sender as ToggleSwitch;
|
||||
|
||||
if (swt != null)
|
||||
{
|
||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
settings.properties.PersistInput.Value = swt.IsOn;
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Toggle_PowerRename_MaxDispListNum_ValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
|
||||
{
|
||||
if (sender != null)
|
||||
{
|
||||
PowerRenameSettings settings = SettingsUtils.GetSettings<PowerRenameSettings>(POWERTOYNAME);
|
||||
settings.properties.MaxMruSize.Value = Convert.ToInt32(sender.Value);
|
||||
|
||||
if (ShellPage.DefaultSndMSGCallback != null)
|
||||
{
|
||||
SndPowerRenameSettings snd = new SndPowerRenameSettings(settings);
|
||||
SndModuleSettings<SndPowerRenameSettings> ipcMessage = new SndModuleSettings<SndPowerRenameSettings>(snd);
|
||||
ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString());
|
||||
}
|
||||
}
|
||||
ViewModel = new PowerRenameViewModel();
|
||||
this.PowerRenameSettingsView.DataContext = ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user