黄学彪
2020-06-10 dce6c3481a37216292724013ff9d2b75ceb82f86
ZigbeeApp/Shared/Phone/UserCenter/Residence/AddNewRoomForm.cs
@@ -385,6 +385,10 @@
                {
                    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();
@@ -440,7 +444,8 @@
                    {
                        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%";
@@ -448,11 +453,8 @@
                            }
                            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() + "%";
                            }
                        });
@@ -460,7 +462,7 @@
                }
            });
            //发送获取湿度的命令
            ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity();
            device.GetType().InvokeMember("ReadTemperatureOrHumidity", System.Reflection.BindingFlags.InvokeMethod, null, device, null);
        }
        #endregion