From 827b6edb38f58c5d7f94a19b0c690a1b9c1ce3f4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 17 Feb 2025 23:12:46 +0800 Subject: [PATCH] Improve code quality --- Plugins/Flow.Launcher.Plugin.Sys/Main.cs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs index 5bfc68ea6..374caa511 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs @@ -120,10 +120,9 @@ namespace Flow.Launcher.Plugin.Sys context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_shutdown_computer"), context.API.GetTranslation("flowlauncher_plugin_sys_shutdown_computer"), MessageBoxButton.YesNo, MessageBoxImage.Warning); + if (result == MessageBoxResult.Yes) - { Process.Start("shutdown", "/s /t 0"); - } return true; } @@ -140,10 +139,9 @@ namespace Flow.Launcher.Plugin.Sys context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_restart_computer"), context.API.GetTranslation("flowlauncher_plugin_sys_restart_computer"), MessageBoxButton.YesNo, MessageBoxImage.Warning); + if (result == MessageBoxResult.Yes) - { Process.Start("shutdown", "/r /t 0"); - } return true; } @@ -204,7 +202,11 @@ namespace Flow.Launcher.Plugin.Sys SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_sleep"), Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xec46"), IcoPath = "Images\\sleep.png", - Action = c => PInvoke.SetSuspendState(false, false, false) + Action = c => + { + PInvoke.SetSuspendState(false, false, false); + return true; + } }, new Result { @@ -231,10 +233,7 @@ namespace Flow.Launcher.Plugin.Sys Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xe773"), Action = c => { - { - System.Diagnostics.Process.Start("control.exe", "srchadmin.dll"); - } - + Process.Start("control.exe", "srchadmin.dll"); return true; } }, @@ -272,10 +271,7 @@ namespace Flow.Launcher.Plugin.Sys CopyText = recycleBinFolder, Action = c => { - { - System.Diagnostics.Process.Start("explorer", recycleBinFolder); - } - + Process.Start("explorer", recycleBinFolder); return true; } },