mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-11 20:23:07 +08:00
Fancy zones settings - Color pickers saved ARGB value fix (now saves RGB) (#2776)
This commit is contained in:
parent
73c6cbb562
commit
59659a13f1
@ -9,6 +9,7 @@ using Microsoft.PowerToys.Settings.UI.Helpers;
|
|||||||
using Microsoft.PowerToys.Settings.UI.Lib;
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
using Microsoft.PowerToys.Settings.UI.ViewModels.Commands;
|
using Microsoft.PowerToys.Settings.UI.ViewModels.Commands;
|
||||||
using Microsoft.PowerToys.Settings.UI.Views;
|
using Microsoft.PowerToys.Settings.UI.Views;
|
||||||
|
using Microsoft.Toolkit.Uwp.Helpers;
|
||||||
using Windows.UI;
|
using Windows.UI;
|
||||||
using Windows.UI.Popups;
|
using Windows.UI.Popups;
|
||||||
|
|
||||||
@ -20,30 +21,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
|
|
||||||
public ButtonClickCommand LaunchEditorEventHandler { get; set; }
|
public ButtonClickCommand LaunchEditorEventHandler { get; set; }
|
||||||
|
|
||||||
public ICommand SaveZoneHighlightColorEventHandler
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new RelayCommand<Color>(SaveZoneHighlightColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand SaveBorderColorEventHandler
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new RelayCommand<Color>(SaveZoneBorderColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand SaveInActiveColorEventHandler
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new RelayCommand<Color>(SaveZoneInActiveColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private FancyZonesSettings Settings { get; set; }
|
private FancyZonesSettings Settings { get; set; }
|
||||||
|
|
||||||
public FancyZonesViewModel()
|
public FancyZonesViewModel()
|
||||||
@ -69,12 +46,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
|
this._appLastZoneMoveWindows = Settings.Properties.FancyzonesAppLastZoneMoveWindows.Value;
|
||||||
this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value;
|
this._useCursorPosEditorStartupScreen = Settings.Properties.UseCursorposEditorStartupscreen.Value;
|
||||||
this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
|
this._showOnAllMonitors = Settings.Properties.FancyzonesShowOnAllMonitors.Value;
|
||||||
this._zoneHighlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value;
|
|
||||||
this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
|
this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
|
||||||
this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
|
this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
|
||||||
this._editorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value;
|
this._editorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value;
|
||||||
this._zoneBorderColor = Settings.Properties.FancyzonesBorderColor.Value;
|
|
||||||
this._zoneInActiveColor = Settings.Properties.FancyzonesInActiveColor.Value;
|
string inactiveColor = Settings.Properties.FancyzonesInActiveColor.Value;
|
||||||
|
this._zoneInActiveColor = inactiveColor != string.Empty ? inactiveColor.ToColor() : "#F5FCFF".ToColor();
|
||||||
|
|
||||||
|
string borderColor = Settings.Properties.FancyzonesBorderColor.Value;
|
||||||
|
this._zoneBorderColor = borderColor != string.Empty ? borderColor.ToColor() : "#FFFFFF".ToColor();
|
||||||
|
|
||||||
|
string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value;
|
||||||
|
this._zoneHighlightColor = highlightColor != string.Empty ? highlightColor.ToColor() : "#0078D7".ToColor();
|
||||||
|
|
||||||
GeneralSettings generalSettings;
|
GeneralSettings generalSettings;
|
||||||
try
|
try
|
||||||
@ -100,12 +83,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
private bool _appLastZoneMoveWindows;
|
private bool _appLastZoneMoveWindows;
|
||||||
private bool _useCursorPosEditorStartupScreen;
|
private bool _useCursorPosEditorStartupScreen;
|
||||||
private bool _showOnAllMonitors;
|
private bool _showOnAllMonitors;
|
||||||
private string _zoneHighlightColor;
|
|
||||||
private int _highlightOpacity;
|
private int _highlightOpacity;
|
||||||
private string _excludedApps;
|
private string _excludedApps;
|
||||||
private HotkeySettings _editorHotkey;
|
private HotkeySettings _editorHotkey;
|
||||||
private string _zoneBorderColor;
|
private Color _zoneInActiveColor;
|
||||||
private string _zoneInActiveColor;
|
private Color _zoneBorderColor;
|
||||||
|
private Color _zoneHighlightColor;
|
||||||
|
|
||||||
public bool IsEnabled
|
public bool IsEnabled
|
||||||
{
|
{
|
||||||
@ -291,7 +275,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ZoneHighlightColor
|
public Color ZoneHighlightColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -303,13 +287,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
if (value != _zoneHighlightColor)
|
if (value != _zoneHighlightColor)
|
||||||
{
|
{
|
||||||
_zoneHighlightColor = value;
|
_zoneHighlightColor = value;
|
||||||
Settings.Properties.FancyzonesZoneHighlightColor.Value = value;
|
Settings.Properties.FancyzonesZoneHighlightColor.Value = ToRGBHex(value);
|
||||||
RaisePropertyChanged();
|
RaisePropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ZoneBorderColor
|
public Color ZoneBorderColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -321,13 +305,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
if (value != _zoneBorderColor)
|
if (value != _zoneBorderColor)
|
||||||
{
|
{
|
||||||
_zoneBorderColor = value;
|
_zoneBorderColor = value;
|
||||||
Settings.Properties.FancyzonesBorderColor.Value = value;
|
Settings.Properties.FancyzonesBorderColor.Value = ToRGBHex(value);
|
||||||
RaisePropertyChanged();
|
RaisePropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ZoneInActiveColor
|
public Color ZoneInActiveColor
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -339,7 +323,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
if (value != _zoneInActiveColor)
|
if (value != _zoneInActiveColor)
|
||||||
{
|
{
|
||||||
_zoneInActiveColor = value;
|
_zoneInActiveColor = value;
|
||||||
Settings.Properties.FancyzonesInActiveColor.Value = value;
|
Settings.Properties.FancyzonesInActiveColor.Value = ToRGBHex(value);
|
||||||
RaisePropertyChanged();
|
RaisePropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,19 +409,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
|||||||
ShellPage.DefaultSndMSGCallback("{\"action\":{\"FancyZones\":{\"action_name\":\"ToggledFZEditor\", \"value\":\"\"}}}");
|
ShellPage.DefaultSndMSGCallback("{\"action\":{\"FancyZones\":{\"action_name\":\"ToggledFZEditor\", \"value\":\"\"}}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveZoneHighlightColor(Color color)
|
private String ToRGBHex(Color color)
|
||||||
{
|
{
|
||||||
ZoneHighlightColor = color.ToString();
|
return "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveZoneBorderColor(Color color)
|
|
||||||
{
|
|
||||||
ZoneBorderColor = color.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveZoneInActiveColor(Color color)
|
|
||||||
{
|
|
||||||
ZoneInActiveColor = color.ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
@ -142,44 +142,28 @@
|
|||||||
IsColorSliderVisible="True"
|
IsColorSliderVisible="True"
|
||||||
IsColorChannelTextInputVisible="True"
|
IsColorChannelTextInputVisible="True"
|
||||||
IsHexInputVisible="True"
|
IsHexInputVisible="True"
|
||||||
IsAlphaEnabled="True"
|
IsAlphaEnabled="False"
|
||||||
IsAlphaSliderVisible="True"
|
IsAlphaSliderVisible="False"
|
||||||
IsAlphaTextInputVisible="True"
|
IsAlphaTextInputVisible="False"
|
||||||
Color="{Binding Path=ZoneHighlightColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
Color="{Binding Path=ZoneHighlightColor, Mode=TwoWay}"
|
||||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
||||||
DataContext="{Binding ZoneHighlightColor, Source={StaticResource eventViewModel}}"/>
|
|
||||||
|
|
||||||
<Button x:Uid="FancyZones_SaveZoneHighlightColor"
|
|
||||||
Margin="{StaticResource SmallTopMargin}"
|
|
||||||
Style="{StaticResource AccentButtonStyle}"
|
|
||||||
Command = "{Binding SaveZoneHighlightColorEventHandler, Source={StaticResource eventViewModel}}"
|
|
||||||
CommandParameter="{Binding Color, ElementName=FancyZones_ZoneHighlightColor}"
|
|
||||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"/>
|
|
||||||
|
|
||||||
<TextBlock x:Uid="FancyZones_InActiveColor"
|
<TextBlock x:Uid="FancyZones_InActiveColor"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
Margin="{StaticResource SmallTopMargin}" />
|
Margin="{StaticResource SmallTopMargin}" />
|
||||||
|
|
||||||
<muxc:ColorPicker x:Name="FancyZones_InActiveColor"
|
<muxc:ColorPicker x:Name="FancyZones_InActiveColorPicker"
|
||||||
Margin="0,6,0,0"
|
Margin="0,6,0,0"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
IsMoreButtonVisible="True"
|
IsMoreButtonVisible="True"
|
||||||
IsColorSliderVisible="True"
|
IsColorSliderVisible="True"
|
||||||
IsColorChannelTextInputVisible="True"
|
IsColorChannelTextInputVisible="True"
|
||||||
IsHexInputVisible="True"
|
IsHexInputVisible="True"
|
||||||
IsAlphaEnabled="True"
|
IsAlphaEnabled="False"
|
||||||
IsAlphaSliderVisible="True"
|
IsAlphaSliderVisible="False"
|
||||||
IsAlphaTextInputVisible="True"
|
IsAlphaTextInputVisible="False"
|
||||||
Color="{Binding Path=ZoneInActiveColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
Color="{Binding Path=ZoneInActiveColor, Mode=TwoWay}"
|
||||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
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"
|
<TextBlock x:Uid="FancyZones_BorderColor"
|
||||||
Style="{StaticResource BodyTextBlockStyle}"
|
Style="{StaticResource BodyTextBlockStyle}"
|
||||||
@ -192,19 +176,12 @@
|
|||||||
IsColorSliderVisible="True"
|
IsColorSliderVisible="True"
|
||||||
IsColorChannelTextInputVisible="True"
|
IsColorChannelTextInputVisible="True"
|
||||||
IsHexInputVisible="True"
|
IsHexInputVisible="True"
|
||||||
IsAlphaEnabled="True"
|
IsAlphaEnabled="False"
|
||||||
IsAlphaSliderVisible="True"
|
IsAlphaSliderVisible="False"
|
||||||
IsAlphaTextInputVisible="True"
|
IsAlphaTextInputVisible="False"
|
||||||
Color="{Binding Path=ZoneBorderColor, Mode=TwoWay, Source={StaticResource eventViewModel}}"
|
Color="{Binding Path=ZoneBorderColor, Mode=TwoWay}"
|
||||||
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
|
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"
|
<TextBlock x:Uid="FancyZones_ExcludeApps"
|
||||||
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
Style="{StaticResource SettingsGroupTitleStyle}"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user