private async Task UpdateGameServerAsync() { if (steamServerQueryService == null) { return; } IsBusy = true; try { Parsers.TryParseIPEndpoint(ServerAdress, out var endPoint); steamServerQueryService.EndPoint = endPoint; SteamServerInfo serverInfo = null; List <PlayerInfo> playerInfo = null; try { serverInfo = await steamServerQueryService.GetServerInfoAsync().ConfigureAwait(false); playerInfo = (await steamServerQueryService.GetPlayersAsync().ConfigureAwait(false))?.Where(x => !string.IsNullOrEmpty(x.Name)).OrderBy(x => x.Name).ToList(); } catch (Exception ex) { ConnectError = true; //Connected = false; return; } Application.Current.Dispatcher.Invoke(new Action(() => { ConnectError = false; Connected = true; PlayerCount = serverInfo.Players; if (playerInfo != null) { if (OnlinePlayers == null) { OnlinePlayers = new ObservableRangeCollection <PlayerInfo>(playerInfo); } else { OnlinePlayers.ReplaceRange(playerInfo); } PlayerCount = OnlinePlayers.Count(); } MaxPlayerCount = serverInfo.MaxPlayers; ServerHeading = $"{serverInfo.Name} ({PlayerCount}/{MaxPlayerCount})"; })); } finally { IsBusy = false; } }