public void GotRecentGames(RecentGames result)
        {
            GameStats.Clear();
            result.GameStatistics.Sort((s1, s2) => s2.CreateDate.CompareTo(s1.CreateDate));
            foreach (PlayerGameStats Game in result.GameStatistics)
            {
                Game.QueueType = Client.TitleCaseString(Game.QueueType.Replace("ODIN", "Dominion").Replace("UNRANKED", "").Replace("_5x5", "").Replace("_", " ")).Replace("Aram", "ARAM").Trim();
                MatchStats Match = new MatchStats();

                foreach (RawStat Stat in Game.Statistics)
                {
                    var type = typeof(MatchStats);
                    string fieldName = Client.TitleCaseString(Stat.StatType.Replace('_', ' ')).Replace(" ", "");
                    var f = type.GetField(fieldName);
                    f.SetValue(Match, Stat.Value);
                }

                Match.Game = Game;

                GameStats.Add(Match);
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                GamesListView.Items.Clear();
                BlueListView.Items.Clear();
                ItemsListView.Items.Clear();
                PurpleListView.Items.Clear();
                GameStatsListView.Items.Clear();
                foreach (MatchStats stats in GameStats)
                {
                    RecentGameOverview item = new RecentGameOverview();
                    champions GameChamp = champions.GetChampion((int)Math.Round(stats.Game.ChampionId));
                    item.ChampionImage.Source = GameChamp.icon;
                    item.ChampionNameLabel.Content = GameChamp.displayName;
                    item.ScoreLabel.Content =
                        string.Format("{0}/{1}/{2} ({3})",
                        stats.ChampionsKilled,
                        stats.NumDeaths,
                        stats.Assists,
                        stats.Game.QueueType);

                    item.MapLabel.Content = BaseMap.GetMap(stats.Game.GameMapId).DisplayName;
                    item.DateLabel.Content = stats.Game.CreateDate;
                    item.IPEarnedLabel.Content = "+" + stats.Game.IpEarned + " IP";
                    item.PingLabel.Content = stats.Game.UserServerPing + "ms";

                    BrushConverter bc = new BrushConverter();
                    Brush brush = (Brush)bc.ConvertFrom("#FF609E74");

                    if (stats.Lose == 1)
                        brush = (Brush)bc.ConvertFrom("#FF9E6060");

                    item.GridView.Background = brush;
                    item.GridView.Width = 250;
                    GamesListView.Items.Add(item);
                }
            }));
        }
 public RecentGames GetRecentGames(double accountId)
 {
     int Id = Invoke("playerStatsService", "getRecentGames", new object[] { accountId });
     while (!results.ContainsKey(Id))
         System.Threading.Thread.Sleep(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     RecentGames result = new RecentGames(messageBody);
     results.Remove(Id);
     return result;
 }
 /// 22.)
 public void GetRecentGames(double accountId, RecentGames.Callback callback)
 {
     RecentGames cb = new RecentGames(callback);
     InvokeWithCallback("playerStatsService", "getRecentGames", new object[] { accountId }, cb);
 }
 public async Task<RecentGames> GetRecentGames(Double accountId)
 {
     int Id = Invoke("playerStatsService", "getRecentGames", new object[] { accountId });
     while (!results.ContainsKey(Id))
         await Task.Delay(10);
     TypedObject messageBody = results[Id].GetTO("data").GetTO("body");
     RecentGames result = new RecentGames(messageBody);
     results.Remove(Id);
     return result;
 }