Пример #1
0
        public static void HandleThermometerThresholdReached(object sender, TemperatureThresholdEventArgs temperatureThresholdEventArgs)
        {
            TemperatureThreshold temperatureThreshold = temperatureThresholdEventArgs.TemperatureThreshold;
            string               name        = temperatureThreshold.Name;
            Temperature          temperature = temperatureThreshold.Temperature;
            TemperatureDirection direction   = temperatureThreshold.Direction;
            string               message     = $"Reached temperature threshold: {name}, temperature = {temperature:F1}, Direction = {direction}";

            WriteLine(message);
        }
        private void HandleTemperatureThresholdReached(object sender, TemperatureThresholdEventArgs e)
        {
            TemperatureThreshold temperatureThreshold = e.TemperatureThreshold;

            _name        = temperatureThreshold.Name;
            _temperature = temperatureThreshold.Temperature;
            _tolerance   = temperatureThreshold.Tolerance;
            _direction   = temperatureThreshold.Direction;

            _eventHandlerCalledCount++;
        }