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); }
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(); }