| | |
| | | {
|
| | | listDevice.Add(device);
|
| | | }
|
| | | else if (device.Type == ZigBee.Device.DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | listDevice.Add(device);
|
| | | }
|
| | | }
|
| | | var listSelect = new List<string>() { newRoom.HumidityDevice };
|
| | | var form = new SelectDeviceForm();
|
| | |
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.AttriButeData == 0)
|
| | | decimal humidity = (decimal)device.GetType().InvokeMember("Humidity", System.Reflection.BindingFlags.GetField, null, device, null);
|
| | | if (humidity == 0)
|
| | | {
|
| | | //0
|
| | | btnHumi.Text = "0.0%";
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位(湿度没有负数)
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录湿度
|
| | | this.newRoom.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | this.newRoom.Humidity = humidity;
|
| | | btnHumi.Text = this.newRoom.Humidity.ToString() + "%";
|
| | | }
|
| | | });
|
| | |
| | | }
|
| | | });
|
| | | //发送获取湿度的命令
|
| | | ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity();
|
| | | device.GetType().InvokeMember("ReadTemperatureOrHumidity", System.Reflection.BindingFlags.InvokeMethod, null, device, null);
|
| | | }
|
| | |
|
| | | #endregion
|