Hotkey tab window add close window on Esc key press

This commit is contained in:
Jeremy Wu 2020-06-19 18:52:11 +10:00
parent 8f411d9ec5
commit 2209bb269d
2 changed files with 18 additions and 7 deletions

View file

@ -6,6 +6,12 @@
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Title="Custom Plugin Hotkey" Height="200" Width="674.766">
<Window.InputBindings>
<KeyBinding Key="Escape" Command="Close"/>
</Window.InputBindings>
<Window.CommandBindings>
<CommandBinding Command="Close" Executed="cmdEsc_OnPress"/>
</Window.CommandBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />

View file

@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using NHotkey;
using NHotkey.Wpf;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using NHotkey;
using NHotkey.Wpf;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using System.Windows.Input;
namespace Flow.Launcher
{
@ -125,5 +125,10 @@ namespace Flow.Launcher
MessageBox.Show(errorMsg);
}
}
private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
{
Close();
}
}
}