예제 #1
0
 public async Task <string> GetPresence()
 {
     if (await _userAuthService.IsUserAuthenticated())
     {
         return(_appState.Presence.Availability);
     }
     else
     {
         return(string.Empty);
     }
 }
예제 #2
0
 protected override async Task ExecuteAsync(CancellationToken stoppingToken)
 {
     while (!stoppingToken.IsCancellationRequested)
     {
         if (await _userAuthService.IsUserAuthenticated())
         {
             _logger.LogInformation("User is Authenticated, starting worker");
             try
             {
                 await Run();
             }
             catch (Exception e)
             {
                 _logger.LogError(e, "Exception occured restarting worker");
             }
         }
         else
         {
             _logger.LogInformation("User is Not Authenticated, restarting worker");
         }
         await Task.Delay(1000, stoppingToken);
     }
 }