Ejemplo n.º 1
0
 public Microprocessor(string name, double temperature, INotify notifier)
 {
     Name             = name;
     Camera           = new Camera(temperature);
     Temperature      = temperature;
     RefrigeratorMode = RefrigeratorModeProvider.RefrigeratorModes[0];
     Compressor       = new Compressor()
     {
         Camera = Camera
     };
     DefrostMachine = new DefrostMachine()
     {
         Camera = Camera
     };
     this.notifier = notifier;
 }
Ejemplo n.º 2
0
 public void UpdateTemperature()
 {
     if (Camera.Temperature > Temperature)
     {
         Compressor.UpdateTemperature(RefrigeratorMode.CoolTemperature);
     }
     else if (Camera.Temperature < Temperature)
     {
         DefrostMachine.UpdateTemperature(RefrigeratorMode.HeatTemperature);
     }
     if (Compressor.Temperature >= Compressor.Threshold)
     {
         Compressor.Enabled = false;
         notifier.Notify();
     }
     if (DefrostMachine.Temperature >= DefrostMachine.Threshold)
     {
         DefrostMachine.Enabled = false;
         notifier.Notify();
     }
 }