Improve code quality

This commit is contained in:
Jack251970 2026-02-21 14:51:20 +08:00
parent 7e9a626891
commit a99b8399fe
2 changed files with 11 additions and 13 deletions

View file

@ -206,7 +206,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\shutdown.png", IcoPath = "Images\\shutdown.png",
Action = c => Action = c =>
{ {
MessageBoxResult result = _settings.SkipPowerActionConfirmation var result = _settings.SkipPowerActionConfirmation
? MessageBoxResult.Yes ? MessageBoxResult.Yes
: Context.API.ShowMsgBox( : Context.API.ShowMsgBox(
Localize.flowlauncher_plugin_sys_dlgtext_shutdown_computer(), Localize.flowlauncher_plugin_sys_dlgtext_shutdown_computer(),
@ -231,7 +231,7 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\restart.png", IcoPath = "Images\\restart.png",
Action = c => Action = c =>
{ {
MessageBoxResult result = _settings.SkipPowerActionConfirmation var result = _settings.SkipPowerActionConfirmation
? MessageBoxResult.Yes ? MessageBoxResult.Yes
: Context.API.ShowMsgBox( : Context.API.ShowMsgBox(
Localize.flowlauncher_plugin_sys_dlgtext_restart_computer(), Localize.flowlauncher_plugin_sys_dlgtext_restart_computer(),
@ -283,16 +283,16 @@ namespace Flow.Launcher.Plugin.Sys
IcoPath = "Images\\logoff.png", IcoPath = "Images\\logoff.png",
Action = c => Action = c =>
{ {
MessageBoxResult result = _settings.SkipPowerActionConfirmation var result = _settings.SkipPowerActionConfirmation
? MessageBoxResult.Yes ? MessageBoxResult.Yes
: Context.API.ShowMsgBox( : Context.API.ShowMsgBox(
Localize.flowlauncher_plugin_sys_dlgtext_logoff_computer(), Localize.flowlauncher_plugin_sys_dlgtext_logoff_computer(),
Localize.flowlauncher_plugin_sys_log_off(), Localize.flowlauncher_plugin_sys_log_off(),
MessageBoxButton.YesNo, MessageBoxImage.Warning); MessageBoxButton.YesNo, MessageBoxImage.Warning);
if (result == MessageBoxResult.Yes) if (result == MessageBoxResult.Yes)
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_LOGOFF, REASON); PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_LOGOFF, REASON);
return true; return true;
} }
}, },
new Result new Result

View file

@ -4,6 +4,4 @@
{ {
public Settings Settings { get; } = settings; public Settings Settings { get; } = settings;
} }
} }