Exemplo n.º 1
0
        private void btn_add_dog_Click(object sender, EventArgs e)
        {
            int  index  = myDogList.Count();
            Hund newDog = new Hund();

            newDog.SetAktuellerZustand("sitzt");

            newDog.State = new Liegen();

            //Zufaelligen Status des Hundes einstellen
            Random rnd         = new Random();
            int    Zufallszahl = rnd.Next(0, 3);

            for (int i = Zufallszahl; i < myDogList.Count; i++)
            {
                newDog.Change();
            }

            myDogList.Add(newDog);
            string dog = index + " " + newDog.HundBeschreibung(newDog);

            listBox1.Items.Add(dog);
        }