static void Main(string[] args) { var remote = new SimpleRemoteControl(); var light = new Light(); var lightOn = new LightOnCommand(light); var garageDoor = new GarageDoor(); var garageOpen = new GarageDoorOpenCommand(garageDoor); remote.Command = lightOn; remote.ButtonWasPressed(); remote.Command = garageOpen; remote.ButtonWasPressed(); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { SimpleRemoteControl remote = new SimpleRemoteControl(); Light light = new Light(); LightOnCommand lightOn = new LightOnCommand(light); GarageDoor garageDoor = new GarageDoor(); GarageDoorOpenCommand garageOpen = new GarageDoorOpenCommand(garageDoor); remote.Command = lightOn; remote.ButtonWasPressed(); remote.Command = garageOpen; remote.ButtonWasPressed(); // Wait for user Console.ReadKey(); }