@@ -193,7 +193,7 @@ private static unsafe bool EnableShutdownPrivilege()
193193 }
194194 }
195195
196- private static List < Result > Commands ( Query query )
196+ private List < Result > Commands ( Query query )
197197 {
198198 var results = new List < Result > ( ) ;
199199 var recycleBinFolder = "shell:RecycleBinFolder" ;
@@ -206,15 +206,16 @@ private static List<Result> Commands(Query query)
206206 IcoPath = "Images\\ shutdown.png" ,
207207 Action = c =>
208208 {
209- var result = Context . API . ShowMsgBox (
210- Localize . flowlauncher_plugin_sys_dlgtext_shutdown_computer ( ) ,
211- Localize . flowlauncher_plugin_sys_shutdown_computer ( ) ,
212- MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
209+ var result = _settings . SkipPowerActionConfirmation
210+ ? MessageBoxResult . Yes
211+ : Context . API . ShowMsgBox (
212+ Localize . flowlauncher_plugin_sys_dlgtext_shutdown_computer ( ) ,
213+ Localize . flowlauncher_plugin_sys_shutdown_computer ( ) ,
214+ MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
215+
213216 if ( result == MessageBoxResult . Yes )
214217 {
215- // Save settings before shutdown to avoid data loss
216218 Context . API . SaveAppAllSettings ( ) ;
217-
218219 if ( EnableShutdownPrivilege ( ) )
219220 PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_SHUTDOWN | EXIT_WINDOWS_FLAGS . EWX_POWEROFF , REASON ) ;
220221 else
@@ -230,15 +231,16 @@ private static List<Result> Commands(Query query)
230231 IcoPath = "Images\\ restart.png" ,
231232 Action = c =>
232233 {
233- var result = Context . API . ShowMsgBox (
234- Localize . flowlauncher_plugin_sys_dlgtext_restart_computer ( ) ,
235- Localize . flowlauncher_plugin_sys_restart_computer ( ) ,
236- MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
234+ var result = _settings . SkipPowerActionConfirmation
235+ ? MessageBoxResult . Yes
236+ : Context . API . ShowMsgBox (
237+ Localize . flowlauncher_plugin_sys_dlgtext_restart_computer ( ) ,
238+ Localize . flowlauncher_plugin_sys_restart_computer ( ) ,
239+ MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
240+
237241 if ( result == MessageBoxResult . Yes )
238242 {
239- // Save settings before restart to avoid data loss
240243 Context . API . SaveAppAllSettings ( ) ;
241-
242244 if ( EnableShutdownPrivilege ( ) )
243245 PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_REBOOT , REASON ) ;
244246 else
@@ -254,10 +256,13 @@ private static List<Result> Commands(Query query)
254256 IcoPath = "Images\\ restart_advanced.png" ,
255257 Action = c =>
256258 {
257- var result = Context . API . ShowMsgBox (
258- Localize . flowlauncher_plugin_sys_dlgtext_restart_computer_advanced ( ) ,
259- Localize . flowlauncher_plugin_sys_restart_computer ( ) ,
260- MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
259+ var result = _settings . SkipPowerActionConfirmation
260+ ? MessageBoxResult . Yes
261+ : Context . API . ShowMsgBox (
262+ Localize . flowlauncher_plugin_sys_dlgtext_restart_computer_advanced ( ) ,
263+ Localize . flowlauncher_plugin_sys_restart_computer ( ) ,
264+ MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
265+
261266 if ( result == MessageBoxResult . Yes )
262267 {
263268 // Save settings before advanced restart to avoid data loss
@@ -278,10 +283,13 @@ private static List<Result> Commands(Query query)
278283 IcoPath = "Images\\ logoff.png" ,
279284 Action = c =>
280285 {
281- var result = Context . API . ShowMsgBox (
282- Localize . flowlauncher_plugin_sys_dlgtext_logoff_computer ( ) ,
283- Localize . flowlauncher_plugin_sys_log_off ( ) ,
284- MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
286+ var result = _settings . SkipPowerActionConfirmation
287+ ? MessageBoxResult . Yes
288+ : Context . API . ShowMsgBox (
289+ Localize . flowlauncher_plugin_sys_dlgtext_logoff_computer ( ) ,
290+ Localize . flowlauncher_plugin_sys_log_off ( ) ,
291+ MessageBoxButton . YesNo , MessageBoxImage . Warning ) ;
292+
285293 if ( result == MessageBoxResult . Yes )
286294 PInvoke . ExitWindowsEx ( EXIT_WINDOWS_FLAGS . EWX_LOGOFF , REASON ) ;
287295 return true ;
0 commit comments