Refactor: Improve power action logic and property setter

- Add braces for better readability in shutdown/reboot logic (Main.cs).
- Prevent redundant OnPropertyChanged calls in _skipPowerActionConfirmation setter (Settings.cs).
This commit is contained in:
DB P 2026-02-20 17:34:37 +09:00
parent 2d7d025682
commit cecd90e675
2 changed files with 15 additions and 10 deletions

View file

@ -222,7 +222,7 @@ namespace Flow.Launcher.Plugin.Sys
Process.Start("shutdown", "/s /t 0");
}
return true;
}
}
},
new Result
{
@ -238,15 +238,15 @@ namespace Flow.Launcher.Plugin.Sys
Localize.flowlauncher_plugin_sys_restart_computer(),
MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes)
{
Context.API.SaveAppAllSettings();
if (EnableShutdownPrivilege())
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
else
Process.Start("shutdown", "/r /t 0");
}
return true;
if (result == MessageBoxResult.Yes)
{
Context.API.SaveAppAllSettings();
if (EnableShutdownPrivilege())
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
else
Process.Start("shutdown", "/r /t 0");
}
return true;
}
},
new Result

View file

@ -130,7 +130,12 @@ public class Settings : BaseModel
get => _skipPowerActionConfirmation;
set
{
if (_skipPowerActionConfirmation == value)
{
return;
}
_skipPowerActionConfirmation = value;
OnPropertyChanged();
}
}
}