Example #1
0
        private void gridDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try {
                if (e.RowIndex < 0)
                {
                    return;
                }

                if (gridDetails.Columns[e.ColumnIndex].Name == "Info")
                {
                    using (LevelDetails levelDetails = new LevelDetails()) {
                        LevelStats stats = gridDetails.Rows[e.RowIndex].DataBoundItem as LevelStats;
                        levelDetails.LevelName = stats.Name;
                        List <RoundInfo> rounds = stats.Stats;
                        rounds.Sort(delegate(RoundInfo one, RoundInfo two) {
                            return(one.Start.CompareTo(two.Start));
                        });
                        levelDetails.RoundDetails = rounds;
                        levelDetails.StatsForm    = this;
                        levelDetails.ShowDialog(this);
                    }
                }
            } catch (Exception ex) {
                MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void lblTotalShows_Click(object sender, EventArgs e)
        {
            try {
                using (LevelDetails levelDetails = new LevelDetails()) {
                    levelDetails.LevelName = "Shows";
                    List <RoundInfo> rounds = new List <RoundInfo>();
                    for (int i = 0; i < StatDetails.Count; i++)
                    {
                        rounds.AddRange(StatDetails[i].Stats);
                    }
                    rounds.Sort(delegate(RoundInfo one, RoundInfo two) {
                        return(one.Start.CompareTo(two.Start));
                    });

                    List <RoundInfo> shows = new List <RoundInfo>();
                    int      roundCount    = 0;
                    int      kudosTotal    = 0;
                    bool     won           = false;
                    bool     isFinal       = false;
                    DateTime endDate       = DateTime.MinValue;
                    for (int i = rounds.Count - 1; i >= 0; i--)
                    {
                        RoundInfo info = rounds[i];
                        if (roundCount == 0)
                        {
                            endDate = info.End;
                            won     = info.Qualified;
                            LevelStats levelStats = StatLookup[info.Name];
                            isFinal = levelStats.Type == LevelType.Final;
                        }
                        roundCount++;
                        kudosTotal += info.Kudos;
                        if (info.Round == 1)
                        {
                            shows.Insert(0, new RoundInfo()
                            {
                                Name = isFinal ? "Final" : string.Empty, End = endDate, Start = info.Start, Kudos = kudosTotal, Qualified = won, Round = roundCount, ShowID = info.ShowID, Tier = won ? 1 : 0
                            });
                            roundCount = 0;
                            kudosTotal = 0;
                        }
                    }
                    levelDetails.RoundDetails = shows;
                    levelDetails.StatsForm    = this;
                    levelDetails.ShowDialog(this);
                }
            } catch (Exception ex) {
                MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
 private void lblTotalRounds_Click(object sender, EventArgs e)
 {
     try {
         using (LevelDetails levelDetails = new LevelDetails()) {
             levelDetails.LevelName = "Rounds";
             List <RoundInfo> rounds = new List <RoundInfo>();
             for (int i = 0; i < StatDetails.Count; i++)
             {
                 rounds.AddRange(StatDetails[i].Stats);
             }
             rounds.Sort(delegate(RoundInfo one, RoundInfo two) {
                 return(one.Start.CompareTo(two.Start));
             });
             levelDetails.RoundDetails = rounds;
             levelDetails.StatsForm    = this;
             levelDetails.ShowDialog(this);
         }
     } catch (Exception ex) {
         MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }