static void Main(string[] args) { //Existing stuff in the house Light light = new Light(); AirConditioner airConditioner = new AirConditioner(); // Create the On Commands LightOn turnOnLight = new LightOn(light); AirConditionerOn turnOnAC = new AirConditionerOn(airConditioner); // Create the Off Commands LightOff turnOffLight = new LightOff(light); AirConditionerOff turnOffAC = new AirConditionerOff(airConditioner); // Program remote controller RemoteController remote = new RemoteController(); remote.InsertNewOnCommand(turnOnLight); remote.InsertNewOnCommand(turnOnAC); remote.InsertNewOffCommand(turnOffLight); remote.InsertNewOffCommand(turnOffAC); // Test buttons: Turn On the lights and AC remote.PressButtonOn(0); remote.PressButtonOn(1); // Test buttons: Turn Off the lights and AC remote.PressButtonOff(0); remote.PressButtonOff(1); Console.ReadLine(); }
static void Main(string[] args) { //Existing stuff in the house Light bedRoomLights = new Light(); AirConditioner acForEntireHouse = new AirConditioner(); //Create the ON commands LightOn turnBedRoomLightsOn = new LightOn(bedRoomLights); AirConditionerOn turnOnAc = new AirConditionerOn(acForEntireHouse); //Create the OFF commands LightOff turnBedRoomLightOff = new LightOff(bedRoomLights); AirConditionerOff turnOffAc = new AirConditionerOff(acForEntireHouse); //Add the ON to the remote RemoteController remote = new RemoteController(); remote.InsertNewOnCommand(turnBedRoomLightsOn); remote.InsertNewOnCommand(turnOnAc); //Add the OFF to the remote remote.InsertNewOffCommand(turnBedRoomLightOff); remote.InsertNewOffCommand(turnOffAc); //Turn on the lights and AC remote.PressButtonOn(0); remote.PressButtonOn(1); //Turn off the lights and AC remote.PressButtonOff(0); remote.PressButtonOff(1); }