private void CreateWagon(Animal animal)
        {
            var wagon = new Wagon();

            wagon.AddAnimal(animal);
            _train.AddWagon(wagon);
            listBox2.Items.Add(wagon.ToString());
        }
Beispiel #2
0
        private void filledAnimalsBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Wagon  foundWagon = train.GetWagons().Single(wagon => wagon.ToString() == filledAnimalsBox.Text);
            string message    = "";

            foreach (Animal animal in foundWagon.GetFilledAnimals())
            {
                message += animal.getString() + "\n";
            }

            MessageBox.Show("Animals: " + message, "Wagon: " + foundWagon.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }