Skip to content

Commit eae4a95

Browse files
committed
Use readonly bool variable
1 parent 365ba6a commit eae4a95

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Flow.Launcher/Helper/AutoStartup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)