Пример #1
0
        public void RegisrterForTemperatureChange(RefrigeratorRegistrationInfo refrigeratorRegistrationInfo)
        {
            TemperatureThresholdRegistrationInfo temperatureThresholdRegistrationInfo = new TemperatureThresholdRegistrationInfo();

            temperatureThresholdRegistrationInfo.Threshold       = refrigeratorRegistrationInfo.Threshold;
            temperatureThresholdRegistrationInfo.WaiverMargin    = refrigeratorRegistrationInfo.WaiverMargin;
            temperatureThresholdRegistrationInfo.ChangeDirection = refrigeratorRegistrationInfo.ChangeDirection;
            temperatureThresholdRegistrationInfo.TemperatureThresholedReachedHandler = Handler;
            _thermoMeter.RequestRegistration(temperatureThresholdRegistrationInfo);
        }
Пример #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();
        }