Пример #1
0
 public void SimulateTemp(double temp)
 {
     if (TemperatureTooHigh != null && temp > 25)
     {
         foreach (var item in TemperatureTooHigh.GetInvocationList().ToList())
         {
             TermometroEventHandler temp_eh = (TermometroEventHandler)item;
             temp_eh(this, temp);
         }
     }
     else
     {
         Console.WriteLine("Temperature is lower than 25");
     }
 }
Пример #2
0
        public void SimulateTemperatureTooHigh(int detectedtemperature)
        {
            TemperatureEventArgs args = new TemperatureEventArgs()
            {
                DetectedTemperature = detectedtemperature
            };

            if (TemperatureTooHigh != null && detectedtemperature > 25)
            {
                foreach (var item in TemperatureTooHigh.GetInvocationList())
                {
                    TemperatureEventHandler t_eh = (TemperatureEventHandler)item;
                    t_eh(this, args);
                }
            }
        }