Пример #1
0
        public void Run()
        {
            //Existing Stuff in house
            Light BedroomLights = new Light();
            AirConditioner AC = new AirConditioner();

            //Prepare Commands
            LightsOn TurnBedroomLightOn = new LightsOn(BedroomLights);
            AirConOn TurnAirConOn = new AirConOn(AC);

            LightsOff TurnBedRoomLightOff = new LightsOff(BedroomLights);
            AirConOff TurnAirConOff = new AirConOff(AC);

            //Controller

            RemoteControl RemoteControl = new RemoteControl();
            RemoteControl.InsertNewCommandOn(TurnBedroomLightOn);
            RemoteControl.InsertNewCommandOn(TurnAirConOn);
            RemoteControl.InsertNewCommandOff(TurnBedRoomLightOff);
            RemoteControl.InsertNewCommandOff(TurnAirConOff);

            //Test
            RemoteControl.TurnOn(0);
            RemoteControl.TurnOn(1);
            RemoteControl.TurnOff(0);
            RemoteControl.TurnOff(1);
        }
Пример #2
0
        public void Run()
        {
            //Existing Stuff in house
            Light          BedroomLights = new Light();
            AirConditioner AC            = new AirConditioner();

            //Prepare Commands
            LightsOn TurnBedroomLightOn = new LightsOn(BedroomLights);
            AirConOn TurnAirConOn       = new AirConOn(AC);

            LightsOff TurnBedRoomLightOff = new LightsOff(BedroomLights);
            AirConOff TurnAirConOff       = new AirConOff(AC);

            //Controller

            RemoteControl RemoteControl = new RemoteControl();

            RemoteControl.InsertNewCommandOn(TurnBedroomLightOn);
            RemoteControl.InsertNewCommandOn(TurnAirConOn);
            RemoteControl.InsertNewCommandOff(TurnBedRoomLightOff);
            RemoteControl.InsertNewCommandOff(TurnAirConOff);

            //Test
            RemoteControl.TurnOn(0);
            RemoteControl.TurnOn(1);
            RemoteControl.TurnOff(0);
            RemoteControl.TurnOff(1);
        }