Пример #1
0
        private Bettor WhoIsBetting()
        {
            Bettor activeBettor = null;

            for (int i = 0; i < bettors.Length; i++)
            {
                if (bettors[i].myRadioButton.Checked)
                {
                    activeBettor = bettors[i];
                }
            }
            return(activeBettor);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bettor currentBettor = WhoIsBetting();

            if (!currentBettor.PlaceBet((int)betAmountControl.Value, (int)racerSelectionControl.Value))
            {
                MessageBox.Show("Not enough funds.");
            }
            else
            {
                currentBettor.PlaceBet((int)betAmountControl.Value, (int)racerSelectionControl.Value);
                Update();
            }
        }
Пример #3
0
        private void InitBettors()
        {
            //Create our bettors, and add them to their array.
            joe = new Bettor()
            {
                myCash = 50, myLabel = bettorOneLabel, myRadioButton = bettorOneRadio, name = "Joe"
            };
            al = new Bettor()
            {
                myCash = 45, myLabel = bettorTwoLabel, myRadioButton = bettorTwoRadio, name = "Al"
            };
            bob = new Bettor()
            {
                myCash = 75, myLabel = bettorThreeLabel, myRadioButton = bettorThreeRadio, name = "Bob"
            };

            bettors = new Bettor[] { joe, al, bob };
        }