// Stores global history in a dictionary. public void StoreGlobalHistory(TextBox status) { int matchCount = 1; Parallel.ForEach(personalHistory.Keys, matchId => { if (!status.InvokeRequired) { status.Text = "Found all games. Loading game data " + matchCount + "/" + personalHistory.Keys.Count + "."; status.Refresh(); } String matchInfoUrl = Coder.GetMatchInfoUrl(region, matchId); String matchInfoJson = reader.Request(matchInfoUrl); MatchInfo matchInfo = Parser.ParseMatchInfo(matchInfoJson); globalHistory[matchId] = new List <GlobalParticipant>(); foreach (MatchInfoNameSpace.Participant participant in matchInfo.participants) { globalHistory[matchId].Add(new GlobalParticipant(participant.teamId, participant.stats.winner, participant.championId)); } Interlocked.Increment(ref matchCount); }); }
// Stores global history in a dictionary. public void StoreGlobalHistory(TextBox status) { int matchCount = 1; foreach (int matchId in personalHistory.Keys) { status.Text = "Found all games. Loading game data " + matchCount + "/" + personalHistory.Keys.Count + "."; status.Refresh(); String matchInfoUrl = Coder.GetMatchInfoUrl(region, matchId); String matchInfoJson = reader.Request(matchInfoUrl); MatchInfo matchInfo = Parser.ParseMatchInfo(matchInfoJson); globalHistory[matchId] = new List <GlobalParticipant>(); foreach (MatchInfoNameSpace.Participant participant in matchInfo.participants) { globalHistory[matchId].Add(new GlobalParticipant(participant.teamId, participant.stats.winner, participant.championId)); } matchCount += 1; } }