Files
ThreadPilot/Services/WpfApplicationShutdownService.cs
PrimeBuild-pc af3812fb5a fix: in-app update closes through the graceful shutdown
Application.Shutdown ignored the window's cancel, so Game Boost, reset-on-exit and the default
power plan were never restored before the installer took over.
2026-10-22 10:54:37 +02:00

32 lines
893 B
C#

/*
* ThreadPilot - graceful shutdown hook after updater launch.
*/
namespace ThreadPilot.Services
{
using System.Windows;
public sealed class WpfApplicationShutdownService : IApplicationShutdownService
{
public void RequestShutdownForUpdate()
{
var application = Application.Current;
if (application == null)
{
return;
}
// The graceful path restores Game Boost, process changes and the power plan, then always exits.
application.Dispatcher.InvokeAsync(async () =>
{
if (application.MainWindow is MainWindow window)
{
await window.ShutdownForUpdateAsync();
return;
}
application.Shutdown();
});
}
}
}