Esempio n. 1
0
 public SensorValueReachedTrigger(INumericValueSensor sensor)
 {
     if (sensor == null)
     {
         throw new ArgumentNullException(nameof(sensor));
     }
     sensor.StateChanged += (s, e) => CheckValue(sensor);
 }
        public NumericValueSensorHasValueLowerThanCondition(INumericValueSensor sensor, float value)
        {
            if (sensor == null)
            {
                throw new ArgumentNullException(nameof(sensor));
            }

            WithExpression(() => sensor.GetCurrentNumericValue() < value);
        }
        private void CheckValue(INumericValueSensor sensor)
        {
            var newValue = sensor.GetCurrentNumericValue();

            if (newValue >= Target)
            {
                if (_invoked)
                {
                    return;
                }

                _invoked = true;
                Execute();

                return;
            }

            if (newValue < Target - Delta)
            {
                _invoked = false;
            }
        }
Esempio n. 4
0
        private void CheckValue(INumericValueSensor sensor)
        {
            var newValue = sensor.GetCurrentNumericValue();

            if (newValue >= Target)
            {
                if (_invoked)
                {
                    return;
                }

                _invoked = true;
                Execute();

                return;
            }

            if (newValue < Target - Delta)
            {
                _invoked = false;
            }
        }
        public NumericValueSensorHasValueLowerThanCondition(INumericValueSensor sensor, float value)
        {
            if (sensor == null) throw new ArgumentNullException(nameof(sensor));

            WithExpression(() => sensor.GetCurrentNumericValue() < value);
        }
 public SensorValueReachedTrigger(INumericValueSensor sensor)
 {
     if (sensor == null) throw new ArgumentNullException(nameof(sensor));
     sensor.StateChanged += (s, e) => CheckValue(sensor);
 }
 protected virtual void OnSensorValueChanged(INumericValueSensor sensor, float newValue)
 {
 }
 protected virtual void OnSensorValueChanged(INumericValueSensor sensor, float newValue)
 {
 }