Example #1
0
 public void PressButton()
 {
     if (_door.IsOpen())
     {
         _door.Close();
         return;
     }
     _door.Open();
     System.Console.WriteLine("Door is opened!");
 }
Example #2
0
        public void Recognize(Bark bark)
        {
            Console.WriteLine("Bark Recognizer:Heard a '" + bark.Sound + "'");
            List <Bark> allowedbarks = _door.AllowedBark;

            foreach (Bark allowedbark in allowedbarks)
            {
                if (allowedbark.Equals(bark))
                {
                    _door.Open();
                    return;
                }
            }
            Console.WriteLine("Sorry this dog is not allowed");
        }