示例#1
0
 public void PressButton()
 {
     Console.WriteLine("Pressing the remote control button..");
     if (door.IsOpen())
     {
         door.Close();
     }
     else
     {
         door.Open();
     }
 }
示例#2
0
        public void recognize(Bark bark)
        {
            Console.WriteLine("  BarkRecognizer: Heard a '" + bark.GetSound + "'");
            List <Bark> allowedBarks = door.getAllowedBarks();

            foreach (var bark1 in allowedBarks)
            {
                Bark allowedBark = (Bark)bark1;
                if (allowedBark.CheckBarkEquals(bark))
                {
                    door.Open();
                    return;
                }
            }
            Console.WriteLine("This dog is not allowed.");
        }
示例#3
0
 public void recognize(String bark)
 {
     Console.WriteLine("BarkRecognizer: Heard a " + bark);
     door.Open();
 }