Exemple #1
0
 private async Task UpdateStatusBarItems()
 {
     this.Version = string.Format("Version: {0}", await _dhtTiny.GetFirmwareVersionAsync());
     this.Id      = string.Format("ID: 0x{0:X2}", await _dhtTiny.GetDeviceIdAsync());
     this.Address = string.Format("Address: 0x{0:X2}", await _dhtTiny.GetDeviceAddressAsync());
     this.Model   = string.Format("DHT{0}", await _dhtTiny.GetDeviceModelAsync());
 }
Exemple #2
0
        protected async override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            try
            {
                // ***
                // *** Get and cache the current values.
                // ***
                _interval = await _dhtTiny.GetIntervalAsync();

                _lowerThreshold = await _dhtTiny.GetLowerThresholdAsync();

                _upperThreshold = await _dhtTiny.GetUpperThresholdAsync();

                _startDelay = await _dhtTiny.GetStartDelayAsync();

                _address = await _dhtTiny.GetDeviceAddressAsync();

                _model = await _dhtTiny.GetDeviceModelAsync();

                // ***
                // *** Update the dialog.
                // ***
                this.interval.Value       = _interval;
                this.lowerThreshold.Value = _lowerThreshold;
                this.upperThreshold.Value = _upperThreshold;
                this.startDelay.Value     = _startDelay;
                this.address.Value        = _address;
                this.model.SelectedIndex  = _models.Where(t => t.Model == _model).Select(t => t.Index).FirstOrDefault();
            }
            catch (Exception ex)
            {
                (new MessageDialog(ex.Message)).ShowAsync().AsTask().Wait();
            }
        }