Beispiel #1
0
        static void Main(string[] args)
        {
            SimpleRemoteControl remote = new SimpleRemoteControl();
            Light    light             = new Light();
            LightOn  lightOn           = new LightOn(light);
            LightOff lightOff          = new LightOff(light);

            remote.SetCommand(0, lightOn, lightOff);
            remote.OnButtonWasPressed(0);
            remote.OffButtonWasPressed(0);

            GarageDoor      door      = new GarageDoor();
            GarageDoorOpen  doorOpen  = new GarageDoorOpen(door);
            GarageDoorClose doorClose = new GarageDoorClose(door);

            remote.SetCommand(1, doorOpen, doorClose);
            remote.OnButtonWasPressed(1);
            remote.OffButtonWasPressed(1);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            SimpleRemoteControl remote = new SimpleRemoteControl();
            Light light = new Light();
            LightOn lightOn = new LightOn(light);
            LightOff lightOff = new LightOff(light);

            remote.SetCommand(0, lightOn, lightOff);
            remote.OnButtonWasPressed(0);
            remote.OffButtonWasPressed(0);

            GarageDoor door = new GarageDoor();
            GarageDoorOpen doorOpen = new GarageDoorOpen(door);
            GarageDoorClose doorClose = new GarageDoorClose(door);

            remote.SetCommand(1, doorOpen, doorClose);
            remote.OnButtonWasPressed(1);
            remote.OffButtonWasPressed(1);
        }