Esempio n. 1
0
        static void Main(string[] args)
        {
            DogDoor door = new DogDoor();

            door.AddAllowedBarks(new Bark("rowlf"));
            door.AddAllowedBarks(new Bark("roooowlf"));
            door.AddAllowedBarks(new Bark("rawlf"));
            door.AddAllowedBarks(new Bark("woof"));
            Console.WriteLine(door.AllowedBarks.Count);
            // Remote remote = new Remote(door);
            BarkRecognizer recognizer = new BarkRecognizer(door);

            Console.WriteLine("Bruce starts barking... ");
            recognizer.Recognize(new Bark("rowlf"));

            Console.WriteLine("Bruce has gone outside..");

            // recognizer.Recognize("woof");
            // remote.PressButton();
            Thread.Sleep(5000);

            Console.WriteLine("Bruce is all done ");
            Console.WriteLine("But he's stuck outside");
            Bark smallDogBark = new Bark("Yip");

            Console.WriteLine("A small dog starts barking..");
            recognizer.Recognize(smallDogBark);
            Thread.Sleep(5000);

            Console.WriteLine("Bruce starts barking.. ");
            recognizer.Recognize(new Bark("rooowlf"));
            // remote.PressButton();
            Console.WriteLine("Bruce's back inside..");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            DogDoor door = new DogDoor();

            door.AddAllowedBark(new Bark("rowlf"));
            door.AddAllowedBark(new Bark("rooowlf"));
            door.AddAllowedBark(new Bark("rawlf"));
            door.AddAllowedBark(new Bark("woof"));

            BarkRecognizer recognizer = new BarkRecognizer(door);
            Remote         remote     = new Remote(door);

            Console.WriteLine("Dog starts barking.");
            recognizer.Recognize(new Bark("Rowlf"));

            Console.WriteLine("\nDog has gone outside...");

            try
            {
                Thread.Sleep(10000);
            }
            catch
            {
            }

            Console.WriteLine("\nDog all done...");
            Console.WriteLine("...but he's stuck outside!");

            Bark smallDogBark = new Bark("yip");

            Console.WriteLine("A small dog starts barking.");
            recognizer.Recognize(smallDogBark);

            try
            {
                Thread.Sleep(5000);
            }
            catch
            {
            }

            Console.WriteLine("\nDog starts barking.");
            recognizer.Recognize(new Bark("Rowlf"));

            Console.WriteLine("\nDog is back inside...");
            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var door = new DogDoor();

            door.AddAllowedBark(new Bark("rowlf"));
            door.AddAllowedBark(new Bark("rooowlf"));
            door.AddAllowedBark(new Bark("rawlf"));
            door.AddAllowedBark(new Bark("woof"));

            var recognizer = new BarkRecognizer(door);
            var remote     = new Remote(door);

            Console.WriteLine("Bruce starts Barking...");
            recognizer.Recognize(new Bark("rowlf"));
            Console.WriteLine("Bruce has gone outside....");

            try
            {
                Thread.Sleep(10000);;
            }
            catch (Exception exception) { }

            Console.WriteLine("Bruce all done....");
            Console.WriteLine("...but he's stuck outside!");

            Bark smallDogBark = new Bark("yip");

            Console.WriteLine("A small dog starts barking..");
            recognizer.Recognize(smallDogBark);

            try
            {
                Thread.Sleep(5000);
            }
            catch (Exception exception) { }

            Console.WriteLine("Bruce Starts Barking....");
            recognizer.Recognize(new Bark("rowlf"));
            Console.WriteLine("Bruce's back inside....");
        }