added error handling for FZ Hotkeys (#4057)

* added error handling for FZ Hotkeys

* moved hint to hot key control text

* updated icon size 16px

* updated styling and fixed typos

* fixed typo

* moved text to string resource

Co-authored-by: Lavius Motileng <laviusmotileng-ms>
This commit is contained in:
Lavius Motileng
2020-06-04 14:52:04 -07:00
committed by GitHub
parent 25fbcc144c
commit ac62fd6204
3 changed files with 42 additions and 14 deletions

View File

@@ -281,8 +281,8 @@
<data name="FancyZones_HighlightOpacity.Header" xml:space="preserve">
<value>Zone highlight opacity</value>
</data>
<data name="FancyZones_HokeyEditorControl_Header.Header" xml:space="preserve">
<value>Edit hot key / shortcut</value>
<data name="FancyZones_HotkeyEditorControl.Text" xml:space="preserve">
<value>Edit hotkey / shortcut</value>
</data>
<data name="FancyZones_LaunchEditorButtonControl.Text" xml:space="preserve">
<value>Launch zones editor</value>
@@ -590,4 +590,13 @@
<data name="General_RunAsAdminRequired.Text" xml:space="preserve">
<value>You need to run as administrator to use this setting</value>
</data>
<data name="FancyZones_HotkeyEditorControl.ToolTipService.ToolTip" xml:space="preserve">
<value>Only shortcuts with the following hotkeys are valid: Win, Ctrl, Alt, Shift.</value>
</data>
<data name="FancyZones_HotkeyEditorControl_Icon.ToolTipService.ToolTip" xml:space="preserve">
<value>Only shortcuts with the following hotkeys are valid: Win, Ctrl, Alt, Shift.</value>
</data>
<data name="FancyZones_HotkeyEditorControl_TextBox.ToolTipService.ToolTip" xml:space="preserve">
<value>Only shortcuts with the following hotkeys are valid: Win, Ctrl, Alt, Shift.</value>
</data>
</root>

View File

@@ -49,13 +49,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
this._makeDraggedWindowTransparent = Settings.Properties.FancyzonesMakeDraggedWindowTransparent.Value;
this._highlightOpacity = Settings.Properties.FancyzonesHighlightOpacity.Value;
this._excludedApps = Settings.Properties.FancyzonesExcludedApps.Value;
this._editorHotkey = Settings.Properties.FancyzonesEditorHotkey.Value;
this.EditorHotkey = Settings.Properties.FancyzonesEditorHotkey.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();
this._zoneBorderColor = borderColor != string.Empty ? borderColor.ToColor() : "#FFFFFF".ToColor();
string highlightColor = Settings.Properties.FancyzonesZoneHighlightColor.Value;
this._zoneHighlightColor = highlightColor != string.Empty ? highlightColor.ToColor() : "#0078D7".ToColor();
@@ -378,8 +378,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
if (value != _editorHotkey)
{
_editorHotkey = value;
Settings.Properties.FancyzonesEditorHotkey.Value = value;
if (value.IsEmpty())
{
_editorHotkey = new HotkeySettings(true, false, false, false, "'", 192);
}
else
{
_editorHotkey = value;
}
Settings.Properties.FancyzonesEditorHotkey.Value = _editorHotkey;
RaisePropertyChanged();
}
}

View File

@@ -70,19 +70,30 @@
<TextBlock Margin="12,0,0,0" x:Uid="FancyZones_LaunchEditorButtonControl"/>
</StackPanel>
</Button>
<TextBlock x:Uid="FancyZones_ZoneBehavior_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
/>
<StackPanel Orientation="Horizontal" Margin="{StaticResource SmallTopMargin}">
<TextBlock x:Uid="FancyZones_HotkeyEditorControl"
Text="Editor Hotkeys"/>
<Viewbox Height="14" Width="14" Margin="5,2,0,0" >
<PathIcon
x:Uid="FancyZones_HotkeyEditorControl_Icon"
VerticalAlignment="Center"
Data="M960 1920q-133 0-255-34t-230-96-194-150-150-195-97-229T0 960q0-133 34-255t96-230 150-194 195-150 229-97T960 0q133 0 255 34t230 96 194 150 150 195 97 229 34 256q0 133-34 255t-96 230-150 194-195 150-229 97-256 34zm0-1792q-115 0-221 30t-198 84-169 130-130 168-84 199-30 221q0 114 30 220t84 199 130 169 168 130 199 84 221 30q114 0 220-30t199-84 169-130 130-168 84-199 30-221q0-114-30-220t-84-199-130-169-168-130-199-84-221-30zm-64 640h128v640H896V768zm0-256h128v128H896V512z"/>
</Viewbox>
</StackPanel>
<CustomControls:HotkeySettingsControl
x:Uid="FancyZones_HokeyEditorControl_Header"
Width="240"
HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}"
HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
x:Uid="FancyZones_HotkeyEditorControl_TextBox"
Width="240"
HorizontalAlignment="Left"
Margin="0,5,0,0"
HotkeySettings="{x:Bind Path=ViewModel.EditorHotkey, Mode=TwoWay}"
IsEnabled="{ Binding Mode=TwoWay, Path=IsEnabled}"
/>
<CheckBox x:Uid="FancyZones_ShiftDragCheckBoxControl_Header"
IsChecked="{ Binding Mode=TwoWay, Path=ShiftDrag}"