mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 21:41:51 +02:00
Switch case
This commit is contained in:
@@ -265,10 +265,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
{
|
{
|
||||||
if (_themeIndex != value)
|
if (_themeIndex != value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
switch (value)
|
||||||
{
|
{
|
||||||
// set theme to dark.
|
case 0: GeneralSettingsConfig.Theme = "dark"; break;
|
||||||
GeneralSettingsConfig.Theme = "dark";
|
case 1: GeneralSettingsConfig.Theme = "light"; break;
|
||||||
|
case 2: GeneralSettingsConfig.Theme = "system"; break;
|
||||||
|
}
|
||||||
|
|
||||||
_themeIndex = value;
|
_themeIndex = value;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -284,47 +287,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
|
|
||||||
NotifyPropertyChanged();
|
NotifyPropertyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 1)
|
|
||||||
{
|
|
||||||
// set theme to light.
|
|
||||||
GeneralSettingsConfig.Theme = "light";
|
|
||||||
_themeIndex = value;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateUIThemeCallBack(GeneralSettingsConfig.Theme);
|
|
||||||
}
|
|
||||||
#pragma warning disable CA1031 // Do not catch general exception types
|
|
||||||
catch (Exception e)
|
|
||||||
#pragma warning restore CA1031 // Do not catch general exception types
|
|
||||||
{
|
|
||||||
Logger.LogError("Exception encountered when changing Settings theme", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyPropertyChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value == 2)
|
|
||||||
{
|
|
||||||
// set theme to system default.
|
|
||||||
GeneralSettingsConfig.Theme = "system";
|
|
||||||
_themeIndex = value;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateUIThemeCallBack(GeneralSettingsConfig.Theme);
|
|
||||||
}
|
|
||||||
#pragma warning disable CA1031 // Do not catch general exception types
|
|
||||||
catch (Exception e)
|
|
||||||
#pragma warning restore CA1031 // Do not catch general exception types
|
|
||||||
{
|
|
||||||
Logger.LogError("Exception encountered when changing Settings theme", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
NotifyPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,33 +197,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_themeIndex != value)
|
switch (value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
case 0: settings.Properties.Theme = Theme.Dark; break;
|
||||||
{
|
case 1: settings.Properties.Theme = Theme.Light; break;
|
||||||
// set theme to dark.
|
case 2: settings.Properties.Theme = Theme.System; break;
|
||||||
settings.Properties.Theme = Theme.Dark;
|
|
||||||
_themeIndex = value;
|
|
||||||
UpdateSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 1)
|
|
||||||
{
|
|
||||||
// set theme to light.
|
|
||||||
settings.Properties.Theme = Theme.Light;
|
|
||||||
_themeIndex = value;
|
_themeIndex = value;
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 2)
|
|
||||||
{
|
|
||||||
// set theme to system default.
|
|
||||||
settings.Properties.Theme = Theme.System;
|
|
||||||
_themeIndex = value;
|
|
||||||
UpdateSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int MonitorPositionIndex
|
public int MonitorPositionIndex
|
||||||
@@ -237,24 +220,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
{
|
{
|
||||||
if (_monitorPositionIndex != value)
|
if (_monitorPositionIndex != value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
switch (value)
|
||||||
{
|
{
|
||||||
settings.Properties.Position = StartupPosition.Cursor;
|
case 0: settings.Properties.Position = StartupPosition.Cursor; break;
|
||||||
UpdateSettings();
|
case 1: settings.Properties.Position = StartupPosition.PrimaryMonitor; break;
|
||||||
|
case 2: settings.Properties.Position = StartupPosition.Focus; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 1)
|
_monitorPositionIndex = value;
|
||||||
{
|
|
||||||
settings.Properties.Position = StartupPosition.PrimaryMonitor;
|
|
||||||
UpdateSettings();
|
UpdateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 2)
|
|
||||||
{
|
|
||||||
settings.Properties.Position = StartupPosition.Focus;
|
|
||||||
UpdateSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,21 +56,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
_opacity = Settings.Properties.OverlayOpacity.Value;
|
_opacity = Settings.Properties.OverlayOpacity.Value;
|
||||||
_disabledApps = Settings.Properties.DisabledApps.Value;
|
_disabledApps = Settings.Properties.DisabledApps.Value;
|
||||||
|
|
||||||
string theme = Settings.Properties.Theme.Value;
|
switch (Settings.Properties.Theme.Value)
|
||||||
|
|
||||||
if (theme == "dark")
|
|
||||||
{
|
{
|
||||||
_themeIndex = 0;
|
case "dark": _themeIndex = 0; break;
|
||||||
}
|
case "light": _themeIndex = 1; break;
|
||||||
|
case "system": _themeIndex = 2; break;
|
||||||
if (theme == "light")
|
|
||||||
{
|
|
||||||
_themeIndex = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme == "system")
|
|
||||||
{
|
|
||||||
_themeIndex = 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,30 +120,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
{
|
{
|
||||||
if (_themeIndex != value)
|
if (_themeIndex != value)
|
||||||
{
|
{
|
||||||
if (value == 0)
|
switch (value)
|
||||||
{
|
{
|
||||||
// set theme to dark.
|
case 0: Settings.Properties.Theme.Value = "dark"; break;
|
||||||
Settings.Properties.Theme.Value = "dark";
|
case 1: Settings.Properties.Theme.Value = "light"; break;
|
||||||
_themeIndex = value;
|
case 2: Settings.Properties.Theme.Value = "system"; break;
|
||||||
NotifyPropertyChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 1)
|
|
||||||
{
|
|
||||||
// set theme to light.
|
|
||||||
Settings.Properties.Theme.Value = "light";
|
|
||||||
_themeIndex = value;
|
_themeIndex = value;
|
||||||
NotifyPropertyChanged();
|
NotifyPropertyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == 2)
|
|
||||||
{
|
|
||||||
// set theme to system default.
|
|
||||||
Settings.Properties.Theme.Value = "system";
|
|
||||||
_themeIndex = value;
|
|
||||||
NotifyPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ Disabling this module or closing PowerToys will unmute the microphone and camera
|
|||||||
<value>Excluded apps</value>
|
<value>Excluded apps</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="FancyZones_ExcludeApps.Description" xml:space="preserve">
|
<data name="FancyZones_ExcludeApps.Description" xml:space="preserve">
|
||||||
<value>Excludes an application from snappting to zones and will only react to Windows Snap. Add one application name per line.</value>
|
<value>Excludes an application from snapping to zones and will only react to Windows Snap. Add one application name per line.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="FancyZones_HighlightOpacity.Header" xml:space="preserve">
|
<data name="FancyZones_HighlightOpacity.Header" xml:space="preserve">
|
||||||
<value>Zone opacity</value>
|
<value>Zone opacity</value>
|
||||||
@@ -971,7 +971,6 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
|||||||
<value>Windows</value>
|
<value>Windows</value>
|
||||||
<comment>refers to a set of windows, not the product name</comment>
|
<comment>refers to a set of windows, not the product name</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="PowerRename_BehaviorHeader.Header" xml:space="preserve">
|
<data name="PowerRename_BehaviorHeader.Header" xml:space="preserve">
|
||||||
<value>Behavior</value>
|
<value>Behavior</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -1129,7 +1128,6 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
|||||||
<data name="FancyZones_QuickLayoutSwitch.Description" xml:space="preserve">
|
<data name="FancyZones_QuickLayoutSwitch.Description" xml:space="preserve">
|
||||||
<value>You can configure layout-specific shortcuts in the editor</value>
|
<value>You can configure layout-specific shortcuts in the editor</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="FancyZones_QuickLayoutSwitch_GroupSettings.Text" xml:space="preserve">
|
<data name="FancyZones_QuickLayoutSwitch_GroupSettings.Text" xml:space="preserve">
|
||||||
<value>Quick layout switch</value>
|
<value>Quick layout switch</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user