Example #1
0
        /// <summary>
        /// Event that fires when Picture Boxes are pressed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChangeChampionValueEvent(object sender, ChampionValueChangeArgs e)
        {
            SavedChampion sc = _save.Champion[e.Id];

            sc.Quantity = e.Value;

            CountingLabelReload?.Invoke(sender, new EventArgs()); // If not null -> use
        }
        /// <summary>
        /// Update counting labels.
        /// </summary>
        private void SetCountingLabels()
        {
            int l90 = 0, l270 = 0, l630 = 0, l960 = 0, l1260 = 0, l1560 = 0;
            int total = 0;

            if (_save != null)
            {
                foreach (ChampionData champion in _championData)
                {
                    SavedChampion champ = _save.Champion.FirstOrDefault(x => x.Name.Equals(champion.Name));
                    switch (champion.Price)
                    {
                    case 450:
                        l90  += champ.Quantity;
                        total = total + 90 * champ.Quantity;
                        break;

                    case 1350:
                        l270 += champ.Quantity;
                        total = total + 270 * champ.Quantity;
                        break;

                    case 3150:
                        l630 += champ.Quantity;
                        total = total + 630 * champ.Quantity;
                        break;

                    case 4800:
                        l960 += champ.Quantity;
                        total = total + 960 * champ.Quantity;
                        break;

                    case 6300:
                        l1260 += champ.Quantity;
                        total  = total + 1260 * champ.Quantity;
                        break;

                    case 7800:
                        l1560 += champ.Quantity;
                        total  = total + 1560 * champ.Quantity;
                        break;
                    }
                }
            }


            label90.Text   = l90 + " x 90";
            label270.Text  = l270 + " x 270";
            label630.Text  = l630 + " x 630";
            label960.Text  = l960 + " x 960";
            label1260.Text = l1260 + " x 1260";
            label1560.Text = l1560 + " x 1560";

            total = total + Convert.ToInt32(numericUpDown.Value);

            labelScore.Text = total + " BE";
        }