@@ -564,12 +564,17 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
564564
565565 DebugLogger . LogVariable ( isInstalled , "isInstalled" ) ;
566566
567- _canRepairApp . Value = false ; // not implemented
568- _canInstallApp . Value = ! isInstalled ;
569- _canCheckForAppUpdates . Value = isInstalled ;
570- _canStartApp . Value = isInstalled ;
567+ bool canRepairApp = false ; // not implemented
568+ bool canInstallApp = ! isInstalled ;
569+ bool canCheckForAppUpdates = isInstalled ;
570+ bool canStartApp = isInstalled ;
571571
572- if ( _canInstallApp . Value && _configuration . AutomaticallyInstallApp && ! _hasAutomaticallyInstalledApp )
572+ _canRepairApp . Value = false ;
573+ _canInstallApp . Value = false ;
574+ _canCheckForAppUpdates . Value = false ;
575+ _canStartApp . Value = false ;
576+
577+ if ( canInstallApp && _configuration . AutomaticallyInstallApp && ! _hasAutomaticallyInstalledApp )
573578 {
574579 DebugLogger . Log ( "Automatically deciding to install app." ) ;
575580 _hasAutomaticallyInstalledApp = true ;
@@ -578,7 +583,7 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
578583 return ;
579584 }
580585
581- if ( _canCheckForAppUpdates . Value && _configuration . AutomaticallyCheckForAppUpdates &&
586+ if ( canCheckForAppUpdates && _configuration . AutomaticallyCheckForAppUpdates &&
582587 ! _hasAutomaticallyCheckedForAppUpdate )
583588 {
584589 DebugLogger . Log ( "Automatically deciding to check for app updates." ) ;
@@ -588,20 +593,31 @@ private void ThreadWaitForUserDecision(CancellationToken cancellationToken)
588593 return ;
589594 }
590595
591- if ( _canStartApp . Value && _configuration . AutomaticallyStartApp && ! _hasAutomaticallyStartedApp )
596+ if ( canStartApp && _configuration . AutomaticallyStartApp && ! _hasAutomaticallyStartedApp )
592597 {
593598 DebugLogger . Log ( "Automatically deciding to start app." ) ;
594599 _hasAutomaticallyStartedApp = true ;
595600 _userDecision = UserDecision . StartAppAutomatically ;
596601 return ;
597602 }
598603
604+ _canRepairApp . Value = canRepairApp ;
605+ _canInstallApp . Value = canInstallApp ;
606+ _canCheckForAppUpdates . Value = canCheckForAppUpdates ;
607+ _canStartApp . Value = canStartApp ;
608+
599609 _userDecisionSetEvent . Reset ( ) ;
600610 using ( cancellationToken . Register ( ( ) => _userDecisionSetEvent . Set ( ) ) )
601611 {
602612 cancellationToken . ThrowIfCancellationRequested ( ) ;
603613 _userDecisionSetEvent . WaitOne ( ) ;
604614 }
615+
616+ _canRepairApp . Value = false ;
617+ _canInstallApp . Value = false ;
618+ _canCheckForAppUpdates . Value = false ;
619+ _canStartApp . Value = false ;
620+
605621 cancellationToken . ThrowIfCancellationRequested ( ) ;
606622
607623 DebugLogger . Log ( string . Format ( "Waiting for user decision result: {0}." , _userDecision ) ) ;
0 commit comments