Пример #1
0
        private void resetBtn_Click(object sender, EventArgs e)
        {
            foreach (DogGreyHound dg in dogStarts)
            {
                dg.DogStartPosition();
            }
            if (tejbirBetLabel.Text == "BUSTED" && rajinderBetLabel.Text == "BUSTED" && sandeepBetLabel.Text == "BUSTED")
            {
                setRaceTrack();

                clientArray[0] = new DogPunter()       //punter class Initialization
                {
                    ClientName    = "Tejbir",          // name of client
                    dogBet        = null,              //Set the bet null
                    Cashes        = 70,                //set cash 70
                    MyRadioButton = radioButtonJasbir, //assign radio buuton
                    MyLabel       = tejbirBetLabel     //assign the labl to punter class
                };

                clientArray[1] = new DogPunter()
                {
                    ClientName    = "Rajinder",
                    dogBet        = null,
                    Cashes        = 95,
                    MyRadioButton = radioButtonRajinder,
                    MyLabel       = rajinderBetLabel
                };

                clientArray[2] = new DogPunter()
                {
                    ClientName    = "Sandeep",
                    dogBet        = null,
                    Cashes        = 65,
                    MyRadioButton = radioButtonSandeep,
                    MyLabel       = sandeepBetLabel
                };

                foreach (DogPunter punter in clientArray)
                {
                    punter.UpdatingLabels();
                }
                radioButtonJasbir.Enabled   = true;
                radioButtonRajinder.Enabled = true;
                radioButtonSandeep.Enabled  = true;
                numericUpDownForBet.Value   = 1;
                numericUpDownNumber.Value   = 1;
            }
        }
Пример #2
0
        private void setRaceTrack()//setting the race track
        {
            radioButtonJasbir.Checked = true;
            // initialize minimum bet label
            minimumBetLabel.Text = "Minimum Bet : " + numericUpDownForBet.Minimum.ToString() + " dollars";

            // initialize all 4 elements
            dogStarts[0] = new DogGreyHound()
            {
                MyPictureBox        = dog1,
                DogStartingPosition = dog1.Left,
                TrackLength         = dogRaceTrack.Width - dog1.Width,
                Randomizer          = randNumbers
            };

            dogStarts[1] = new DogGreyHound()
            {
                MyPictureBox        = dog2,
                DogStartingPosition = dog2.Left,
                TrackLength         = dogRaceTrack.Width - dog2.Width,
                Randomizer          = randNumbers
            };

            dogStarts[2] = new DogGreyHound()
            {
                MyPictureBox        = dog3,
                DogStartingPosition = dog3.Left,
                TrackLength         = dogRaceTrack.Width - dog3.Width,
                Randomizer          = randNumbers
            };

            dogStarts[3] = new DogGreyHound()
            {
                MyPictureBox        = dog4,
                DogStartingPosition = dog4.Left,
                TrackLength         = dogRaceTrack.Width - dog4.Width,
                Randomizer          = randNumbers
            };

            //initialize all 3 elements
            clientArray[0] = new DogPunter()
            {
                ClientName    = "Jasbir",
                dogBet        = null,
                Cashes        = 50,
                MyRadioButton = radioButtonJasbir,
                MyLabel       = tejbirBetLabel
            };

            clientArray[1] = new DogPunter()
            {
                ClientName    = "Rajinder",
                dogBet        = null,
                Cashes        = 50,
                MyRadioButton = radioButtonRajinder,
                MyLabel       = rajinderBetLabel
            };

            clientArray[2] = new DogPunter()
            {
                ClientName    = "Sandeep",
                dogBet        = null,
                Cashes        = 50,
                MyRadioButton = radioButtonSandeep,
                MyLabel       = sandeepBetLabel
            };

            for (int i = 0; i <= 2; i++)
            {
                clientArray[i].UpdatingLabels();
                clientArray[i].dogBet = new DogBettor();
            }
        }