Esempio n. 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();
        }
Esempio n. 2
0
 public LightOnCommand(Light light)
 {
     this.light = light;
 }
Esempio n. 3
0
 public LightOffCommand(Light light)
 {
     this.Light = light;
 }