File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ public class AutoStartup
1717 private const string LogonTaskName = $ "{ Constant . FlowLauncher } Startup";
1818 private const string LogonTaskDesc = $ "{ Constant . FlowLauncher } Auto Startup";
1919
20+ private static readonly bool _isAdministrator = Win32Helper . IsAdministrator ( ) ;
21+
2022 public static void CheckIsEnabled ( bool useLogonTaskForStartup , bool alwaysRunAsAdministrator )
2123 {
2224 // We need to check both because if both of them are enabled,
@@ -186,7 +188,7 @@ private static bool ScheduleLogonTask(bool alwaysRunAsAdministrator)
186188 td . Actions . Add ( Constant . ExecutablePath ) ;
187189
188190 // Only if the app is running as administrator, we can set the run level to highest
189- if ( Win32Helper . IsAdministrator ( ) && alwaysRunAsAdministrator )
191+ if ( _isAdministrator && alwaysRunAsAdministrator )
190192 {
191193 td . Principal . RunLevel = TaskRunLevel . Highest ;
192194 }
You can’t perform that action at this time.
0 commit comments