Exemple #1
0
        private void NewBarPressureMeasurement(BarPressureMeasurement newMeasurement)
        {
            var newValue = newMeasurement.Value;

            if (_currentBarometricPressureUnit == BarometricPressureUnit.InHg)
            {
                newValue = UnitConverter.IntoInHg(newValue);
            }
            BarometricPressure = newValue.ToString("F");
        }
Exemple #2
0
        public void ReadMeasurement()
        {
            var randomNumber   = Random.NextDouble() * 70 + 980;
            var newMeasurement = new BarPressureMeasurement
            {
                Value     = randomNumber,
                TimeStamp = DateTime.Now
            };

            _eventAggregator.GetEvent <NewBarPressure>().Publish(newMeasurement);
        }
Exemple #3
0
        private void CalculateBarometricPressureTrend(BarPressureMeasurement newBarPressure)
        {
            var barometricPressureTrend = newBarPressure.Value - _lastBarometricPressure;

            _lastBarometricPressure = newBarPressure.Value;
            _nextTrend = BarometricPressureTrend.Stable;

            if (barometricPressureTrend >= 4 || barometricPressureTrend <= -4)
            {
                var barPerMinute = barometricPressureTrend /
                                   (newBarPressure.TimeStamp.Millisecond - _lastMeasurementTime.Millisecond) * 60;
                _nextTrend           = ConvertBarPerMinuteIntoTrend(barPerMinute);
                _lastMeasurementTime = newBarPressure.TimeStamp;
            }

            _eventAggregator.GetEvent <NewBarometricPressureTrend>().Publish(_nextTrend);
        }