Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            RemoteControl         remote   = new RemoteControl();
            Light                 light    = new Light();
            LightOnCommand        lightOn  = new LightOnCommand(light);
            GarageDoor            door     = new GarageDoor();
            GarageDoorOpenCommand doorOpen = new GarageDoorOpenCommand(door);

            remote.SetCommand(lightOn);
            remote.ButtonWasPressed();
            remote.SetCommand(doorOpen);
            remote.ButtonWasPressed();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            var remote = new Invokers.SimpleRemoteControl();

            var light      = new Light();
            var garageDoor = new GarageDoor();

            var lightOn    = new LightOnCommand(light);
            var garageOpen = new GarageDoorOpenCommand(garageDoor);

            remote.SetCommand(lightOn);
            remote.ButtonWasPressed();

            remote.SetCommand(garageOpen);
            remote.ButtonWasPressed();
        }