static void Main(string[] args) { Console.WriteLine("Hello world"); // create light ReceiverLight light = new ReceiverLight(); // create a "turn light on" command with reference to the light we want to change LightSwichOnCommand onCommand = new LightSwichOnCommand(light); // create remote InvokerLightRemote remote = new InvokerLightRemote(); // add command and execute remote.execute(onCommand); // undo last command remote.undo(); // undo non-existing next command remote.undo(); }
public LightSwichOnCommand(ReceiverLight r) { this.receiver = r; }