public StatisticsViewModel()
        {
            _DataFromThingSpeak   = new RootObject();
            _ReadMeasurements     = new ReadMeasurementFromWeb();
            ReadMeasurementsClick = new ReadMeasurementsCommand(this);

            AmontOfReading      = 0;
            _SelectedTimeRange  = 12;
            ReadButtonIsEnabled = true;
        }
示例#2
0
        public MainViewModel()
        {
            _DataFromThingSpeak = new RootObject();
            _ReadMasurements    = new ReadMeasurementFromWeb();
            Timer = new DispatcherTimer();
            Messenger.Default.Register <MvvmMessage>(this, HandleMessage);

            Timer.Tick    += Timer_Tick;
            Timer.Interval = new TimeSpan(0, 5, 0);
            SetUpModel();
        }
        public async void ReadData()
        {
            ReadButtonIsEnabled = false;
            _ReadMeasurements   = new ReadMeasurementFromWeb();
            _DataFromThingSpeak = await _ReadMeasurements.ReadChannelField(_SelectedTimeRange);

            if (_DataFromThingSpeak != null)
            {
                SendReadMeasurements();

                AmontOfReading = _DataFromThingSpeak.Measurements.Count;

                SearchHighLowHumidity();
                SearchHighLowTemperatureBMP();
                SearchHighLowTemperatureDHT();
                SearchHighLowPressure();

                UpdateValues();
            }
            ReadButtonIsEnabled = true;
        }