Esempio n. 1
0
 public KettleController(IPowerSwitch powerSwitch, IPowerLamp powerLamp, ITemperatureSensor temperatureSensor,
                         IWaterSensor waterSensor, IHeatingElement heatingElement)
 {
     this._powerSwitch             = powerSwitch;
     this._powerLamp               = powerLamp;
     this._temperatureSensor       = temperatureSensor;
     this._waterSensor             = waterSensor;
     this._heatingElement          = heatingElement;
     this._isComponentsInitialized = false;
 }
Esempio n. 2
0
        //constructor
        public KettleController( IPowerSwitch ps, IPowerLamp pl, IHeatingElement he, ITemperatureSensor ts, IWaterSensor ws)
        {
            this.powerSwitch = ps;
            this.powerSwitch.SwitchedOn+=new EventHandler( powerSwitch_SwitchedOn);
            this.powerSwitch.SwitchedOff+=new EventHandler( powerSwitch_SwitchedOff);

            this.powerLamp = pl;
            this.powerLamp.SwitchedOn+=new EventHandler (powerLamp_SwitchedOn);
               this.powerLamp.SwitchedOff+=new EventHandler (powerLamp_SwitchedOff);

               this.heatingElement = he;
               this.temperatureSensor = ts;
               this.waterSensor = ws;
        }
        public KettleController(IPowerSwitch powerSwitch,
                                IPowerLamp powerLamp,
                                IHeatingElement heatingElement,
                                IWaterSensor waterSensor,
                                ITemperatureSensor temperatureSensor)
        {
            this.powerSwitch       = powerSwitch ?? throw new ArgumentNullException(nameof(powerSwitch));
            this.powerLamp         = powerLamp ?? throw new ArgumentNullException(nameof(powerLamp));
            this.heatingElement    = heatingElement ?? throw new ArgumentNullException(nameof(heatingElement));
            this.waterSensor       = waterSensor ?? throw new ArgumentNullException(nameof(waterSensor));
            this.temperatureSensor = temperatureSensor ?? throw new ArgumentNullException(nameof(temperatureSensor));

            this.powerSwitch.SwitchedOn         += PowerSwitch_SwitchedOn;
            this.powerSwitch.SwitchedOff        += PowerSwitch_SwitchedOff;
            this.temperatureSensor.ValueChanged += TemperatureSensor_ValueChanged;
            this.waterSensor.ValueChanged       += WaterSensor_ValueChanged;
        }