From cecd90e6750a7633c82c5928dabfe05c3dce2355 Mon Sep 17 00:00:00 2001 From: DB P Date: Fri, 20 Feb 2026 17:34:37 +0900 Subject: [PATCH] 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). --- Plugins/Flow.Launcher.Plugin.Sys/Main.cs | 20 ++++++++++---------- Plugins/Flow.Launcher.Plugin.Sys/Settings.cs | 5 +++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs index bd4360a41..72b02052d 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs @@ -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 diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Settings.cs b/Plugins/Flow.Launcher.Plugin.Sys/Settings.cs index dc6bf9b4e..c24c51961 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Settings.cs @@ -130,7 +130,12 @@ public class Settings : BaseModel get => _skipPowerActionConfirmation; set { + if (_skipPowerActionConfirmation == value) + { + return; + } _skipPowerActionConfirmation = value; + OnPropertyChanged(); } } }