private async Task <bool> RefreshPlayersListAsync() { DisposeGuard(); ICollection <Player> players; try { players = IsAnonymous ? new List <Player>() : (await _client.GetPlayersAsync(_loginResult?.TokenString)).ToList(); } catch (Exception e) { OnBackgroundError(ServiceConnectionEventArgs.Error(e)); return(false); } var oldPlayers = Players?.Select(x => x.Name) ?? Enumerable.Empty <string>(); var newPlayers = players.Select(x => x.Name); if (newPlayers.SequenceEqual(oldPlayers)) { return(false); } _players.Clear(); _players.AddRange(players); return(true); }
public async Task <IEnumerable <Player> > GetPlayers() { await Login(); return(await _client.GetPlayersAsync(JwtToken)); }