File tree Expand file tree Collapse file tree 3 files changed +55
-11
lines changed Expand file tree Collapse file tree 3 files changed +55
-11
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,14 @@ private void AutoStartup()
119
119
{
120
120
try
121
121
{
122
- Helper . AutoStartup . Enable ( _settings . UseLogonTaskForStartup ) ;
122
+ if ( _settings . UseLogonTaskForStartup )
123
+ {
124
+ Helper . AutoStartup . EnableViaLogonTask ( ) ;
125
+ }
126
+ else
127
+ {
128
+ Helper . AutoStartup . EnableViaRegistry ( ) ;
129
+ }
123
130
}
124
131
catch ( Exception e )
125
132
{
Original file line number Diff line number Diff line change @@ -68,7 +68,35 @@ private static bool CheckLogonTask()
68
68
return false ;
69
69
}
70
70
71
- public static void Disable ( bool logonTask )
71
+ public static void DisableViaLogonTaskAndRegistry ( )
72
+ {
73
+ Disable ( true ) ;
74
+ Disable ( false ) ;
75
+ }
76
+
77
+ public static void EnableViaLogonTask ( )
78
+ {
79
+ Enable ( true ) ;
80
+ }
81
+
82
+ public static void EnableViaRegistry ( )
83
+ {
84
+ Enable ( false ) ;
85
+ }
86
+
87
+ public static void ChangeToViaLogonTask ( )
88
+ {
89
+ Disable ( false ) ;
90
+ Enable ( true ) ;
91
+ }
92
+
93
+ public static void ChangeToViaRegistry ( )
94
+ {
95
+ Disable ( true ) ;
96
+ Enable ( false ) ;
97
+ }
98
+
99
+ private static void Disable ( bool logonTask )
72
100
{
73
101
try
74
102
{
@@ -89,7 +117,7 @@ public static void Disable(bool logonTask)
89
117
}
90
118
}
91
119
92
- internal static void Enable ( bool logonTask )
120
+ private static void Enable ( bool logonTask )
93
121
{
94
122
try
95
123
{
Original file line number Diff line number Diff line change @@ -43,14 +43,18 @@ public bool StartFlowLauncherOnSystemStartup
43
43
{
44
44
if ( value )
45
45
{
46
- // Enable either registry or task scheduler
47
- AutoStartup . Enable ( UseLogonTaskForStartup ) ;
46
+ if ( UseLogonTaskForStartup )
47
+ {
48
+ AutoStartup . EnableViaLogonTask ( ) ;
49
+ }
50
+ else
51
+ {
52
+ AutoStartup . EnableViaRegistry ( ) ;
53
+ }
48
54
}
49
55
else
50
56
{
51
- // Disable both registry and task scheduler
52
- AutoStartup . Disable ( true ) ;
53
- AutoStartup . Disable ( false ) ;
57
+ AutoStartup . DisableViaLogonTaskAndRegistry ( ) ;
54
58
}
55
59
}
56
60
catch ( Exception e )
@@ -72,9 +76,14 @@ public bool UseLogonTaskForStartup
72
76
{
73
77
try
74
78
{
75
- // Disable and enable to update the startup method
76
- AutoStartup . Disable ( ! UseLogonTaskForStartup ) ;
77
- AutoStartup . Enable ( UseLogonTaskForStartup ) ;
79
+ if ( UseLogonTaskForStartup )
80
+ {
81
+ AutoStartup . ChangeToViaLogonTask ( ) ;
82
+ }
83
+ else
84
+ {
85
+ AutoStartup . ChangeToViaRegistry ( ) ;
86
+ }
78
87
}
79
88
catch ( Exception e )
80
89
{
You can’t perform that action at this time.
0 commit comments