示例#1
0
        static void Main(string[] args)
        {
            RemoteControl control = new RemoteControl();
            SmartLight    light   = new SmartLight();

            control.SetCommand(new LightOnCommand(light), new LightOffCommand(light));
            SmartConditioner conditioner = new SmartConditioner();

            control.SetCommand(new ConditionerOnCommand(conditioner), new ConditionerOffCommand(conditioner));


            control.SetCommandTemperature(new ConditionerSetTempCommand(conditioner));

            Console.ReadLine();
            control.TurnAll();

            Console.ReadLine();
            control.SetTemperature(67);

            Console.ReadLine();
            control.TurnOff();

            Console.ReadLine();
        }
示例#2
0
 public ConditionerSetTempCommand(SmartConditioner smartConditioner)
 {
     _smartConditioner = smartConditioner;
 }
示例#3
0
 public ConditionerOffCommand(SmartConditioner smartConditioner)
 {
     _smartConditioner = smartConditioner;
 }