Beispiel #1
0
        static void Main(string[] args)
        {
            SimpleRemoteControl control = new SimpleRemoteControl();
            Light livingRoomLight = new Light("Living Room");
            Light kitchenLight = new Light("Kitchen");

            LightOnCommand lightOnCommand = new LightOnCommand(livingRoomLight);
            LightOffCommand lightOffCommand = new LightOffCommand(livingRoomLight);
            control.SetCommand(0, lightOnCommand, lightOffCommand);

            lightOnCommand = new LightOnCommand(kitchenLight);
            lightOffCommand = new LightOffCommand(kitchenLight);
            control.SetCommand(1, lightOnCommand, lightOffCommand);

            Console.WriteLine(control.ToString());
            Console.ReadLine();
        }
 public LightOnCommand(Light light)
 {
     this.light = light;
 }
 public LightOffCommand(Light light)
 {
     this.Light = light;
 }