Exemplo n.º 1
0
 /// <summary>
 /// Removes animal from list.
 /// </summary>
 /// <param name="a"></param>
 public void RemoveAnimal(Animal a)
 {
     if (animals != null && animals.Contains(a))
     {
         animals.Remove(a);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Add an animal to list
 /// </summary>
 /// <param name="a"></param>
 public void AddAnimal(Animal a)
 {
     if (animals != null)
     {
         a.Id = animalCounter;
         animals.Add(a);
         animalCounter++;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Reads Special categories fields
 /// </summary>
 /// <param name="animal"></param>
 private bool ReadCategoryFields(Animal animal)
 {
     bool fieldsOk = false;
     if (animal != null)
     {
         if (animal is AnimalFolder.Bird)
         {
             ReadBirdFields(animal as AnimalFolder.Bird);
             if (animal is BirdFolder.Duck)
             {
                fieldsOk = ReadDuckFields(animal as BirdFolder.Duck);
             }
             else if(animal is BirdFolder.Eagle)
             {
                fieldsOk = ReadEagleFields(animal as BirdFolder.Eagle);
             }
         }
         else if (animal is AnimalFolder.Mammal)
         {
             ReadMammalFields(animal as AnimalFolder.Mammal);
             if (animal is MammalFolder.Cat)
             {
                fieldsOk = ReadCatFields(animal as Cat);
             }
             else if (animal is MammalFolder.Dog)
             {
                fieldsOk = ReadDogFields(animal as MammalFolder.Dog);
             }
         }
     }
     return fieldsOk;
 }