public Form1() { InitializeComponent(); int raceTrack = background.Size.Width; Console.WriteLine(raceTrack.ToString()); greyhoundArray = new List <Greyhound>(); greyhoundArray.Add(jackson = new Greyhound() { pictureBox = jacksonDog, raceTrackLength = raceTrack }); greyhoundArray.Add(hagan = new Greyhound() { pictureBox = haganDog, raceTrackLength = raceTrack }); greyhoundArray.Add(harry = new Greyhound() { pictureBox = harryDog, raceTrackLength = raceTrack }); greyhoundArray.Add(fender = new Greyhound() { pictureBox = fenderDog, raceTrackLength = raceTrack }); bookersArray = new List <Booker>(); bookersArray.Add(janek = new Booker() { name = "Janek", cash = 100, myLabel = janekLabel, myRadioButton = janekButton, description = janekDescription }); bookersArray.Add(ignacy = new Booker() { name = "Ignacy", cash = 210, myLabel = ignacyLabel, myRadioButton = ignacyButton, description = ignacyDescription }); bookersArray.Add(piotrek = new Booker() { name = "Piotrek", cash = 143, myLabel = piotrekLabel, myRadioButton = piotrekButton, description = piotrekDescription }); //wyświetlenie incjalnych labelek :) foreach (Booker guy in bookersArray) { guy.updateLabels(); guy.firstDescription(); } }
private void betButton_Click(object sender, EventArgs e) { int indexOfBooker = 0; switch (activeBooker.Text) { case "Janek": indexOfBooker = 0; break; case "Ignacy": indexOfBooker = 1; break; case "Piotrek": indexOfBooker = 2; break; } Booker help = bookersArray[indexOfBooker]; help.placeBet((int)betAmount.Value, (int)dogNumber.Value); help.updateLabels(); }
public Form1() { InitializeComponent(); int raceTrack = background.Size.Width; Console.WriteLine(raceTrack.ToString()); greyhoundArray = new List<Greyhound>(); greyhoundArray.Add(jackson = new Greyhound() { pictureBox = jacksonDog, raceTrackLength = raceTrack }); greyhoundArray.Add(hagan = new Greyhound() { pictureBox = haganDog, raceTrackLength = raceTrack }); greyhoundArray.Add(harry = new Greyhound() { pictureBox = harryDog, raceTrackLength = raceTrack }); greyhoundArray.Add(fender = new Greyhound() { pictureBox = fenderDog, raceTrackLength = raceTrack }); bookersArray = new List<Booker>(); bookersArray.Add(janek = new Booker() { name = "Janek", cash = 100, myLabel = janekLabel, myRadioButton = janekButton, description = janekDescription }); bookersArray.Add(ignacy = new Booker() { name = "Ignacy", cash = 210, myLabel = ignacyLabel, myRadioButton = ignacyButton, description = ignacyDescription }); bookersArray.Add(piotrek = new Booker() { name = "Piotrek", cash = 143, myLabel = piotrekLabel, myRadioButton = piotrekButton, description = piotrekDescription }); //wyświetlenie incjalnych labelek :) foreach (Booker guy in bookersArray) { guy.updateLabels(); guy.firstDescription(); } }