public void Execute() { _garageDoor.LightOn(); _garageDoor.Up(); _garageDoor.Stop(); _garageDoor.LightOff(); }
public void Undo() { _garageDoor.LightOn(); _garageDoor.Up(); _garageDoor.Stop(); _garageDoor.LightOff(); }
public void Execute() { _garageDoor.Up(); _garageDoor.LightOn(); Console.WriteLine("Garage door is open"); }
public static void Run() { // Invoker RemoteControlWithUndo remoteControl = new RemoteControlWithUndo(); // Receivers Light livingRoomLight = new Light("Living Room"); Light kitchenLight = new Light("Kitchen"); CeilingFan ceilingFan = new CeilingFan("Living Room"); GarageDoor garageDoor = new GarageDoor(""); Stereo stereo = new Stereo("Living Room"); // Set Commands remoteControl.SetCommand(0, () => { livingRoomLight.On(); }, () => { livingRoomLight.Off(); }); remoteControl.SetCommand(1, () => { kitchenLight.On(); }, () => { kitchenLight.Off(); }); remoteControl.SetCommand(2, () => { ceilingFan.Low(); }, () => { ceilingFan.Off(); }); remoteControl.SetCommand(3, () => { ceilingFan.Medium(); }, () => { ceilingFan.Off(); }); remoteControl.SetCommand(4, () => { ceilingFan.High(); }, () => { ceilingFan.Off(); }); remoteControl.SetCommand(5, () => { garageDoor.Up(); }, () => { garageDoor.Down(); }); Action stereoOnWithCD = () => { stereo.On(); stereo.SetCd(); stereo.SetVolume(11); }; remoteControl.SetCommand(6, stereoOnWithCD, () => { stereo.Off(); }); // Invoke Commands Console.WriteLine("=================================================="); Console.WriteLine("============= Testing Remote Loader ============="); Console.WriteLine("=================================================="); Console.WriteLine(); Console.WriteLine(remoteControl); Console.WriteLine(); for (int i = 0; i < remoteControl.numberOfSlots; i++) { remoteControl.OnButtonWasPushed(i); remoteControl.OffButtonWasPushed(i); } }
public void Execute() { _garageDoor.Up(); }
public void Undo() { _door.Up(); }
public void Undo() { GarageDoor.Up(); }
public void Excecute() { _door.Up(); }
public void execute() { garageDoor.Up(); }
public void undo() { garageDoor.Up(); }
public string Execute() { return(garageDoor.Up()); }
public void Execute() { door.Up(); }
public void Execute() => garageDoor.Up();
public void ExecuteCommand() { _door.Up(); Console.WriteLine("Garage Door is Open"); }
public void Execute(object parameter) { _garageDoor.Up(); }
public void Undo() => garageDoor.Up();