Ejemplo n.º 1
0
        protected void GetStats(string team1, string team2)
        {
            isLoadingStats        = true;
            isLoadingWinningStats = true;
            var statsTask = StatsProvider.GetStatsAsync(team1, team2).ContinueWith(s =>
            {
                isLoadingStats = false;
                Stats          = s.Result;

                Summary = new Dictionary <string, int>
                              ();
                foreach (var stat in Stats)
                {
                    if (Summary.ContainsKey(stat.Winner))
                    {
                        Summary[stat.Winner]++;
                    }
                    else
                    {
                        Summary[stat.Winner] = 1;
                    }
                }

                StateHasChanged();
            }, TaskScheduler.FromCurrentSynchronizationContext());


            var winningStatsTaks = StatsProvider.GetWinningStatsAsync(team1, team2).ContinueWith(ws =>
            {
                isLoadingStats = false;
                WinningStats   = ws.Result;

                StateHasChanged();
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }