Some cleanup in HotkeyControl2Dialog

This commit is contained in:
Yusyuriv 2024-04-21 19:48:35 +06:00
parent 2741485985
commit 9762afdd00
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 6 additions and 16 deletions

View file

@ -26,7 +26,6 @@
<!-- Window title and the keys in the hotkey -->
<Grid
Grid.Row="0"
Grid.Column="0"
Margin="26,12,26,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -40,14 +39,11 @@
Text="{Binding WindowTitle}"
TextAlignment="Left" />
<TextBlock
Grid.Row="0"
FontSize="14"
Text="{DynamicResource hotkeyRegGuide}" />
</StackPanel>
<Border
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="450"
Height="100"
Margin="0,100,0,0"
@ -84,8 +80,7 @@
</Border>
</Grid>
<!-- Action buttons to the right of the title and keys -->
<!-- Warning message for when something went wrong with the new hotkey. -->
<Border Grid.Row="1">
<Border
@ -124,8 +119,6 @@
<!-- Action buttons at the bottom of the dialog -->
<Border
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0"

View file

@ -30,14 +30,11 @@ public partial class HotkeyControl2Dialog : ContentDialog
public HotkeyControl2Dialog(string hotkey, string windowTitle = "")
{
if (windowTitle == string.Empty)
WindowTitle = windowTitle switch
{
WindowTitle = InternationalizationManager.Instance.GetTranslation("hotkeyRegTitle");
}
else
{
WindowTitle = windowTitle;
}
"" or null => InternationalizationManager.Instance.GetTranslation("hotkeyRegTitle"),
_ => windowTitle
};
CurrentHotkey = new HotkeyModel(hotkey);
SetKeysToDisplay(CurrentHotkey);
@ -106,7 +103,7 @@ public partial class HotkeyControl2Dialog : ContentDialog
if (tbMsg == null)
return;
if (!CheckHotkeyAvailability(hotkey.Value, true))
{
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable");