Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
fix some windows missing escape key to exit shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
maxijabase committed Oct 18, 2022
1 parent 32af9b8 commit d7bb081
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions UI/MainWindow/MainWindowMenuHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ private void Menu_Help(object sender, RoutedEventArgs e)
private void Menu_OpenSPDef(object sender, RoutedEventArgs e)
{
var spDefinitionWindow = new SPDefinitionWindow { Owner = this, ShowInTaskbar = false };
DimmMainWindow();
spDefinitionWindow.ShowDialog();
RestoreMainWindow();
}

private void Menu_OpenOptions(object sender, RoutedEventArgs e)
Expand Down
3 changes: 2 additions & 1 deletion UI/Windows/ConfigWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
Title="Configurations"
TitleCaps="False"
ShowTitleBar="true"
Closing="MetroWindow_Closing">
Closing="MetroWindow_Closing"
KeyDown="MetroWindow_KeyDown">

<controls:MetroWindow.Resources>
<ResourceDictionary>
Expand Down
8 changes: 8 additions & 0 deletions UI/Windows/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,14 @@ private void SidebarColumn_SizeChanged(object sender, SizeChangedEventArgs e)
DeleteButtonText.Visibility = Visibility.Visible;
}
}

private void MetroWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
Close();
}
}
#endregion

#region Methods
Expand Down
3 changes: 2 additions & 1 deletion UI/Windows/SPDefinitionWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
WindowStartupLocation="CenterOwner"
GlowBrush="{DynamicResource AccentColorBrush}"
ShowTitleBar="True"
TitleCharacterCasing="Normal">
TitleCharacterCasing="Normal"
KeyDown="MetroWindow_KeyDown">

<controls:MetroWindow.Resources>
<ResourceDictionary>
Expand Down
8 changes: 8 additions & 0 deletions UI/Windows/SPDefinitionWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ private void SPFunctionsListBox_KeyDown(object sender, KeyEventArgs e)
}
}

private void MetroWindow_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
Close();
}
}

private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
SPProgress.IsIndeterminate = true;
Expand Down

0 comments on commit d7bb081

Please sign in to comment.