mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
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:
parent
2d7d025682
commit
cecd90e675
2 changed files with 15 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -130,7 +130,12 @@ public class Settings : BaseModel
|
|||
get => _skipPowerActionConfirmation;
|
||||
set
|
||||
{
|
||||
if (_skipPowerActionConfirmation == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_skipPowerActionConfirmation = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue