Exemple #1
0
        public void RegisrterForTemperatureChange(OvenRegistrationInfo ovenRegistrationInfo)
        {
            TemperatureThresholdRegistrationInfo temperatureThresholdRegistrationInfo = new TemperatureThresholdRegistrationInfo();

            temperatureThresholdRegistrationInfo.Threshold       = ovenRegistrationInfo.Threshold;
            temperatureThresholdRegistrationInfo.WaiverMargin    = ovenRegistrationInfo.WaiverMargin;
            temperatureThresholdRegistrationInfo.ChangeDirection = ovenRegistrationInfo.ChangeDirection;
            temperatureThresholdRegistrationInfo.TemperatureThresholedReachedHandler = Handler;
            _thermoMeter.RequestRegistration(temperatureThresholdRegistrationInfo);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            InMemoryTemperatureReader myTemperatureReader = new InMemoryTemperatureReader();
            ThermoMeter  myThermoMeter  = new ThermoMeter(myTemperatureReader);
            Oven         myOven         = new Oven(myThermoMeter);
            Refrigerator myRefrigerator = new Refrigerator(myThermoMeter);

            OvenRegistrationInfo myOvenRegistrationInfo = new OvenRegistrationInfo(0, 0.5, Direction.Positive);

            myOven.RegisrterForTemperatureChange(myOvenRegistrationInfo);

            RefrigeratorRegistrationInfo myRefrigeratorRegistrationInfo = new RefrigeratorRegistrationInfo(0, 0.5, Direction.None);

            myRefrigerator.RegisrterForTemperatureChange(myRefrigeratorRegistrationInfo);

            for (int i = 0; i < 15; i++)
            {
                myTemperatureReader.Next();
            }

            Console.ReadLine();
        }