Example #1
0
        public void SetChamps(ChampionStatInfoList champs)
        {
            if (champs == null || champs.Count < 1)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new Action <ChampionStatInfoList>(SetChamps), champs);
                return;
            }

            RemoveAll(p => (p.Tag as string) == "Champs");

            var layout = new TableLayoutPanel();

            layout.Dock = DockStyle.Fill;
            foreach (var champ in champs)
            {
                if (champ.ChampionId == 0)
                {
                    continue;
                }

                var lbl = new Label
                {
                    Font     = new Font("Bitstream Vera Sans Mono", 8.25F, FontStyle.Bold),
                    AutoSize = true,
                    Text     = string.Format("{0} ({1})", ChampNames.Get(champ.ChampionId), champ.TotalGamesPlayed)
                };
                layout.Controls.Add(lbl);
            }

            var tab = new TabPage("Champs")
            {
                BackColor = this.BackColor,
                Tag       = "Champs"
            };

            tab.Controls.Add(layout);
            AddTab(tab);
        }
Example #2
0
        public void SetChamps(ChampionStatInfoList champs)
        {
            if (champs == null || champs.Count < 1)
                return;

            if (InvokeRequired)
            {
                Invoke(new Action<ChampionStatInfoList>(SetChamps), champs);
                return;
            }

            RemoveAll(p => (p.Tag as string) == "Champs");

            var layout = new TableLayoutPanel();
            layout.Dock = DockStyle.Fill;
            foreach (var champ in champs)
            {
                if (champ.ChampionId == 0)
                    continue;

                int wins = 0;
                int losses = 0;
                foreach (var stat in champ.Stats)
                {
                    if (stat.StatType == "TOTAL_SESSIONS_WON")
                    {
                        wins = Convert.ToInt32(stat.Value);
                    }
                    else if (stat.StatType == "TOTAL_SESSIONS_LOST")
                    {
                        losses = Convert.ToInt32(stat.Value);
                    }
                }

                var lbl = new Label
                {
                    Font = new Font("Bitstream Vera Sans Mono", 8.25F, FontStyle.Bold),
                    AutoSize = true,
                    Text = string.Format("{0} {1} ({2}%)", ChampNames.Get(champ.ChampionId), champ.TotalGamesPlayed, Math.Round(wins/(double)(wins + losses)*100, 2))
                };
                layout.Controls.Add(lbl);
            }

            var tab = new TabPage("Champs")
            {
                BackColor = this.BackColor,
                Tag = "Champs"
            };
            tab.Controls.Add(layout);
            InfoTabs.TabPages.Add(tab);
        }
Example #3
0
        public void SetChamps(ChampionStatInfoList champs)
        {
            if (champs == null || champs.Count < 1)
                return;

            if (InvokeRequired)
            {
                Invoke(new Action<ChampionStatInfoList>(SetChamps), champs);
                return;
            }

            RemoveAll(p => (p.Tag as string) == "Champs");

            var layout = new TableLayoutPanel();
            layout.Dock = DockStyle.Fill;
            foreach (var champ in champs)
            {
                if (champ.ChampionId == 0)
                    continue;

                var lbl = new Label
                {
                    Font = new Font("Bitstream Vera Sans Mono", 8.25F, FontStyle.Bold),
                    AutoSize = true,
                    Text = string.Format("{0} ({1})", ChampNames.Get(champ.ChampionId), champ.TotalGamesPlayed)
                };
                layout.Controls.Add(lbl);
            }

            var tab = new TabPage("Champs")
            {
                BackColor = this.BackColor,
                Tag = "Champs"
            };
            tab.Controls.Add(layout);
            AddTab(tab);
        }