Esempio n. 1
0
 public void pressButton()
 {
     Console.WriteLine("Pressing the remote control button...");
     if (door.isOpen())
     {
         door.Close();
     }
     else
     {
         door.Open();
     }
 }
Esempio n. 2
0
        public void Recognize(Bark bark)
        {
            // The recognize method ask the owner's dog's bark object to see if it is
            // equal to the Bark instance supplied by Doug's hardware, using Bark.equals()
            Console.WriteLine("BarkRecognizer: Heard a '{0}'", bark.getSound());
            List <Bark> allowedBarks = door.getAllowedBarks();

            foreach (Bark allowedBark in allowedBarks)
            {
                if ((bark.equals(allowedBark)))
                {
                    door.Open();
                    return;
                }
                Console.WriteLine("This dog is not allowed");
            }
        }