Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var remote = new SimpleRemoteControl();

            var light   = new Light();
            var lightOn = new LightOnCommand(light);

            var garageDoor = new GarageDoor();
            var garageOpen = new GarageDoorOpenCommand(garageDoor);

            remote.Command = lightOn;
            remote.ButtonWasPressed();

            remote.Command = garageOpen;
            remote.ButtonWasPressed();

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 public GarageDoorOpenCommand(GarageDoor garageDoor)
 {
     this._garageDoor = garageDoor;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            SimpleRemoteControl remote = new SimpleRemoteControl();

            Light light = new Light();
            LightOnCommand lightOn = new LightOnCommand(light);

            GarageDoor garageDoor = new GarageDoor();
            GarageDoorOpenCommand garageOpen = new GarageDoorOpenCommand(garageDoor);

            remote.Command = lightOn;
            remote.ButtonWasPressed();

            remote.Command = garageOpen;
            remote.ButtonWasPressed();

            // Wait for user
            Console.ReadKey();
        }
 public GarageDoorOpenCommand(GarageDoor garageDoor)
 {
     this._garageDoor = garageDoor;
 }