protected void btn_Set_Click(object sender, EventArgs e)
 {
     Light light = new Light();
     GarageDoor garageDoor = new GarageDoor();
     LightOnCommand lightOn = new LightOnCommand(light);
     GarageDoorUpCommand garageDoorUp = new GarageDoorUpCommand(garageDoor);
     GarageDoorStopCommand garageDoorStop = new GarageDoorStopCommand(garageDoor);
     simpleRemoteControl.setCommand(lightOn);
     simpleRemoteControl.setCommand(garageDoorUp);
     simpleRemoteControl.setCommand(garageDoorStop);
     lbl_Msg.Text = simpleRemoteControl.buttonWasPressed();
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     RemoteControl control=new RemoteControl();
     Light light = new Light();
     LightOnCommand onCommand = new LightOnCommand(light);
     LightOffCommand offCommand=new LightOffCommand(light);
     control.SetCommand(0,onCommand,offCommand);
     System.Console.WriteLine(control.ToString());
     control.OnButtonWasPushed(0);
     control.UndoButtonWasPushed();
     //control.OffButtonWasPushed(0);
     System.Console.ReadKey();
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            RemoteControl   control    = new RemoteControl();
            Light           light      = new Light();
            LightOnCommand  onCommand  = new LightOnCommand(light);
            LightOffCommand offCommand = new LightOffCommand(light);

            control.SetCommand(0, onCommand, offCommand);
            System.Console.WriteLine(control.ToString());
            control.OnButtonWasPushed(0);
            control.UndoButtonWasPushed();
            //control.OffButtonWasPushed(0);
            System.Console.ReadKey();
        }