public void LoadEsports() { try { // clear controls IsAlreadyChecking = true; this.BeginInvoke(new MethodInvoker(delegate { foreach (Control c in ctrls) { ScheduleHostPanel.Controls.Remove(c); } ctrls.Clear(); })); // seek all tourneys Tourneys ts = EsportsRiotApi.GetInstance().GetTourneys(); List <Match> ml = new List <Match>(); foreach (Tourney t in ts.TourneysList) { if (!t.isFinished) { Schedule s = EsportsRiotApi.GetInstance().GetSchedule(t.id); foreach (Match m in s.Matches) { if (m.IsFinished == "0" && m.Contestants != null) { ml.Add(m); } } } } foreach (Match m in ml.OrderBy(x => x.DateTime)) { this.BeginInvoke(new MethodInvoker(delegate { ScheduleControl ctrl = new ScheduleControl(); ctrl.Dock = DockStyle.Top; if (ctrl.Load(m)) { ScheduleHostPanel.Controls.Add(ctrl); ctrls.Add(ctrl); } })); } } catch { } IsAlreadyChecking = false; }
public bool Load(RiotSharp.LolEsportsEndPoint.Match m) { try { gamebx.SubTitle = m.Tournament.Name + " [Round " + m.Tournament.Round + "] " + ((m.DateTime.Year == 1970)?"Soon": m.DateTime.ToString()) + " " + ((m.IsLive) ? "Live" : ""); gamebx.Title = "Best of " + m.MaxGames + " games"; TEAM1PIC.BackgroundImage = new Bitmap(EsportsRiotApi.GetInstance().DownloadIcon(m.Contestants.Blue.LogoURL, Application.StartupPath + @"\Icons\" + m.Contestants.Blue.Acronym + ".png")); TEAM2PIC.BackgroundImage = new Bitmap(EsportsRiotApi.GetInstance().DownloadIcon(m.Contestants.Red.LogoURL, Application.StartupPath + @"\Icons\" + m.Contestants.Red.Acronym + ".png")); TEAM1LB.Text = m.Contestants.Blue.Name; TEAM2LB.Text = m.Contestants.Red.Name; int ml = this.Width / 2; TEAM1PIC.Location = new Point(100, 47); TEAM1LB.Location = new Point(180, 66); VSLB.Location = new Point(ml - 17, 63); TEAM2PIC.Location = new Point(this.Width - 165, 47); TEAM2LB.Location = new Point(this.Width - 187 - (TEAM2LB.Text.Length * 10), 66); return(true); } catch { return(false); } }