예제 #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);
        }
예제 #2
0
        static void Main()
        {
            SimpleRemoteControl remote = new SimpleRemoteControl();
            Light light = new Light();
            LightOnCommand lightOn = new LightOnCommand(light);
            LightOffCommand lightOff = new LightOffCommand(light);

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

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

            remote.SetCommand(1, garageOpen, garageClose);
            remote.OnButtonWasPressed(1);
            remote.OffButtonWasPressed(1);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
예제 #3
0
 public LightOnCommand(Light light)
 {
     this.light =light;
 }
예제 #4
0
 public GarageLightOnCommand(Light light) : base(light) { }
예제 #5
0
 public LightOffCommand(Light light)
 {
     this.light = light;
 }
 public FlipDownCommand(Light light)
 {
     _light = light;
 }
예제 #7
0
 public TurnOffCommand(Light light)
 {
     this.light = light;
 }
예제 #8
0
 public LightOff(Light light)
 {
     this.light = light;
 }
예제 #9
0
 public LightOnCommand(Light inLight)
 {
     this.light = inLight;
 }