mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Save settings before shutdown/restart to prevent data loss
Added a call to `Context.API.SaveAppAllSettings()` before executing system shutdown, restart, or advanced restart operations. This ensures that any unsaved settings are persisted, reducing the risk of data loss during these actions.
This commit is contained in:
parent
7f0851bcb1
commit
e376da4482
1 changed files with 9 additions and 0 deletions
|
|
@ -211,6 +211,9 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Localize.flowlauncher_plugin_sys_shutdown_computer(),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
|
||||
// Save settings before shutdown to avoid data loss
|
||||
Context.API.SaveAppAllSettings();
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
if (EnableShutdownPrivilege())
|
||||
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS.EWX_POWEROFF, REASON);
|
||||
|
|
@ -232,6 +235,9 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Localize.flowlauncher_plugin_sys_restart_computer(),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
|
||||
// Save settings before restart to avoid data loss
|
||||
Context.API.SaveAppAllSettings();
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
if (EnableShutdownPrivilege())
|
||||
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
|
||||
|
|
@ -253,6 +259,9 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Localize.flowlauncher_plugin_sys_restart_computer(),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
||||
|
||||
// Save settings before restart to avoid data loss
|
||||
Context.API.SaveAppAllSettings();
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
if (EnableShutdownPrivilege())
|
||||
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT | EXIT_WINDOWS_FLAGS.EWX_BOOTOPTIONS, REASON);
|
||||
|
|
|
|||
Loading…
Reference in a new issue