public void RenderTopPlayedChampions(ChampionStatInfo[] TopChampions) { ViewAggregatedStatsButton.IsEnabled = false; TopChampionsListView.Items.Clear(); if (TopChampions.Count() > 0) { TopChampionsLabel.Content = "Top Champions (" + TopChampions[0].TotalGamesPlayed + " Ranked Games)"; foreach (ChampionStatInfo info in TopChampions) { ViewAggregatedStatsButton.IsEnabled = true; if (info.ChampionId != 0.0) { ChatPlayer player = new ChatPlayer(); champions Champion = champions.GetChampion(Convert.ToInt32(info.ChampionId)); player.LevelLabel.Visibility = System.Windows.Visibility.Hidden; player.PlayerName.Content = Champion.displayName; player.PlayerStatus.Content = info.TotalGamesPlayed + " games played"; player.ProfileImage.Source = champions.GetChampion(Champion.id).icon; TopChampionsListView.Items.Add(player); } } } }
/// 19.) public ChampionStatInfo[] RetrieveTopPlayedChampions(double accountId, string gameMode) { int Id = Invoke("playerStatsService", "retrieveTopPlayedChampions", new object[] { accountId, gameMode }); while (!results.ContainsKey(Id)) System.Threading.Thread.Sleep(10); ChampionStatInfo[] result = new ChampionStatInfo[results[Id].GetTO("data").GetArray("body").Length]; for (int i = 0; i < results[Id].GetTO("data").GetArray("body").Length; i++) { result[i] = new ChampionStatInfo((TypedObject)results[Id].GetTO("data").GetArray("body")[i]); } results.Remove(Id); return result; }
/// 19.) public async Task<ChampionStatInfo[]> RetrieveTopPlayedChampions(Double accountId, String gameMode) { int Id = Invoke("playerStatsService", "retrieveTopPlayedChampions", new object[] { accountId, gameMode }); while (!results.ContainsKey(Id)) await Task.Delay(10); ChampionStatInfo[] result = new ChampionStatInfo[results[Id].GetTO("data").GetArray("body").Length]; for (int i = 0; i < results[Id].GetTO("data").GetArray("body").Length; i++) { result[i] = new ChampionStatInfo((TypedObject)results[Id].GetTO("data").GetArray("body")[i]); } results.Remove(Id); return result; }