Exemplo n.º 1
0
        private void AddPrize_Click(object sender, EventArgs e)
        {
            PrizeDialog prizeDialog = new PrizeDialog(TournamentAnalytics.PlacesPaid() + 1);

            if (prizeDialog.ShowDialog() == DialogResult.OK)
            {
                TournamentAnalytics.Prizes.Add(prizeDialog.Prize);
                prizesList.Items.Add(new PrizeListBoxItem(TournamentAnalytics.Prizes, TournamentAnalytics.Prizes.Count - 1));
            }
        }
Exemplo n.º 2
0
        private void EditPrize_Click(object sender, EventArgs e)
        {
            int         index       = prizesList.SelectedIndex;
            Prize       oldPrize    = TournamentAnalytics.Prizes[index];
            PrizeDialog prizeDialog =
                new PrizeDialog(TournamentAnalytics.Prizes.GetRange(0, index).Sum(p => p.PlacesPaid) + 1, oldPrize);

            if (prizeDialog.ShowDialog() == DialogResult.OK)
            {
                TournamentAnalytics.Prizes.RemoveAt(index);
                TournamentAnalytics.Prizes.Insert(index, prizeDialog.Prize);
                prizesList.Items[index] = prizesList.Items[index];
            }
        }