mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Don't use Environment.Exit (#20532)
* [Awake] Don't use Process.Exit and move to CsWin32 * [PowerLauncher] Remove unused API * [ColorPicker] Use cancellable NativeEventWaiter + cleanup using * [TextExtractor] Don't use Environment.Exit * [MeasureTool] Don't use Environment.Exit(0); * [FZE] don't use Environment.Exit and fix WaitForPowerToysRunner
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using Common.UI;
|
||||
using interop;
|
||||
using Microsoft.PowerLauncher.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
@@ -52,7 +53,11 @@ namespace PowerLauncher
|
||||
|
||||
_firstDeleteTimer.Elapsed += CheckForFirstDelete;
|
||||
_firstDeleteTimer.Interval = 1000;
|
||||
NativeEventWaiter.WaitForEventLoop(Constants.RunSendSettingsTelemetryEvent(), SendSettingsTelemetry, _nativeWaiterCancelToken);
|
||||
NativeEventWaiter.WaitForEventLoop(
|
||||
Constants.RunSendSettingsTelemetryEvent(),
|
||||
SendSettingsTelemetry,
|
||||
Application.Current.Dispatcher,
|
||||
_nativeWaiterCancelToken);
|
||||
}
|
||||
|
||||
private void SendSettingsTelemetry()
|
||||
@@ -701,7 +706,15 @@ namespace PowerLauncher
|
||||
|
||||
private void OnClosed(object sender, EventArgs e)
|
||||
{
|
||||
_hwndSource.RemoveHook(ProcessWindowMessages);
|
||||
try
|
||||
{
|
||||
_hwndSource.RemoveHook(ProcessWindowMessages);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Exception($"Exception when trying to Remove hook", ex, ex.GetType());
|
||||
}
|
||||
|
||||
_hwndSource = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user