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); }
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()); }
public LightOnCommand(Light light) { this.light =light; }
public GarageLightOnCommand(Light light) : base(light) { }
public LightOffCommand(Light light) { this.light = light; }
public FlipDownCommand(Light light) { _light = light; }
public TurnOffCommand(Light light) { this.light = light; }
public LightOff(Light light) { this.light = light; }
public LightOnCommand(Light inLight) { this.light = inLight; }