public void SetCurrentGamePanel(CurrentGamePanel panel) { this.InvokeSafe(() => { // Remove old game panel and add new one CurrentGameGroupBox.Controls.Remove(CurrentGamePanel); if (panel != null) { panel.Location = new System.Drawing.Point(14, 26); CurrentGameGroupBox.Controls.Add(panel); } CurrentGamePanel = panel; }); }
public static async Task<CurrentGamePanel> GetCurrentGamePanelAsync(CurrentGame currentGame, string summonerName, Region region) { CurrentGamePanel currentGamePanel; if (currentGame != null) { // Get champion data List<ChampionStatic> championStatics = new List<ChampionStatic>(); List<int> summonerIds = new List<int>(); foreach (Participant p in currentGame.Participants) { summonerIds.Add((int)p.SummonerId); ChampionStatic championStatic = await Program.StaticRiotApi.GetChampionAsync(region, (int)p.ChampionId, ChampionData.image); championStatics.Add(championStatic); } // Get league data Dictionary<long, List<League>> leagues = await Program.RiotApi.GetLeaguesAsync(region, summonerIds); currentGamePanel = new CurrentGamePanel(currentGame, summonerName, region, championStatics, leagues); } else { currentGamePanel = null; } return currentGamePanel; }