[FZEditor] stop event waiter (#12529)
This commit is contained in:
parent
7c0cc145eb
commit
88513cf38a
|
@ -3,7 +3,8 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:FancyZonesEditor"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
Startup="OnStartup">
|
||||
Startup="OnStartup"
|
||||
Exit="OnExit">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace FancyZonesEditor
|
|||
|
||||
private ThemeManager _themeManager;
|
||||
|
||||
private EventWaitHandle _eventHandle;
|
||||
|
||||
public static bool DebugMode
|
||||
{
|
||||
get
|
||||
|
@ -83,8 +85,8 @@ namespace FancyZonesEditor
|
|||
|
||||
new Thread(() =>
|
||||
{
|
||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, interop.Constants.FZEExitEvent());
|
||||
if (eventHandle.WaitOne())
|
||||
_eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, interop.Constants.FZEExitEvent());
|
||||
if (_eventHandle.WaitOne())
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
@ -154,6 +156,14 @@ namespace FancyZonesEditor
|
|||
Overlay.Show();
|
||||
}
|
||||
|
||||
private void OnExit(object sender, ExitEventArgs e)
|
||||
{
|
||||
if (_eventHandle != null)
|
||||
{
|
||||
_eventHandle.Set();
|
||||
}
|
||||
}
|
||||
|
||||
public void App_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == System.Windows.Input.Key.LeftShift || e.Key == System.Windows.Input.Key.RightShift)
|
||||
|
|
Loading…
Reference in a new issue