mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FZEditor] stop event waiter (#12529)
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:FancyZonesEditor"
|
xmlns:local="clr-namespace:FancyZonesEditor"
|
||||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||||
Startup="OnStartup">
|
Startup="OnStartup"
|
||||||
|
Exit="OnExit">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
private ThemeManager _themeManager;
|
private ThemeManager _themeManager;
|
||||||
|
|
||||||
|
private EventWaitHandle _eventHandle;
|
||||||
|
|
||||||
public static bool DebugMode
|
public static bool DebugMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -83,8 +85,8 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
new Thread(() =>
|
new Thread(() =>
|
||||||
{
|
{
|
||||||
var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, interop.Constants.FZEExitEvent());
|
_eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, interop.Constants.FZEExitEvent());
|
||||||
if (eventHandle.WaitOne())
|
if (_eventHandle.WaitOne())
|
||||||
{
|
{
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
@@ -154,6 +156,14 @@ namespace FancyZonesEditor
|
|||||||
Overlay.Show();
|
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)
|
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)
|
if (e.Key == System.Windows.Input.Key.LeftShift || e.Key == System.Windows.Input.Key.RightShift)
|
||||||
|
|||||||
Reference in New Issue
Block a user