public async Task <string> GetPresence() { if (await _userAuthService.IsUserAuthenticated()) { return(_appState.Presence.Availability); } else { return(string.Empty); } }
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); } }