| | |
| | | //刷新左滑的房间列表界面的房间列表信息
|
| | | MainPage.ListRoomViewFrom.Instance.RefreshListRoom();
|
| | | }
|
| | |
|
| | | //算了,这里如果按下保存,则主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | |
|
| | | this.CloseForm();
|
| | | };
|
| | | }
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | foreach (var data in report.DeviceStatusReport.AttriBute)
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainKeys);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | if (((ZigBee.Device.TemperatureSensor)localDevice).Temperatrue == 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.AttriButeData == 0)
|
| | | {
|
| | | //0℃
|
| | | btnTemper.Text = "0.0℃";
|
| | | this.cloneRoom.Temperatrue = 0;
|
| | | }
|
| | | else if (data.AttriButeData > 32767)
|
| | | {
|
| | | //负数(特殊处理)
|
| | | string strValue = (data.AttriButeData - 65536).ToString();
|
| | | //小数点需要一位
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | this.cloneRoom.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | btnTemper.Text = this.cloneRoom.Temperatrue.ToString() + "℃";
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录温度
|
| | | this.cloneRoom.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | btnTemper.Text = this.cloneRoom.Temperatrue.ToString() + "℃";
|
| | | }
|
| | | });
|
| | | //0℃
|
| | | btnTemper.Text = "0.0℃";
|
| | | this.cloneRoom.Temperatrue = 0;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //记录温度
|
| | | this.cloneRoom.Temperatrue = ((ZigBee.Device.TemperatureSensor)localDevice).Temperatrue;
|
| | | btnTemper.Text = this.cloneRoom.Temperatrue.ToString() + "℃";
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }));
|
| | | //发送获取温度的命令
|
| | | ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity();
|
| | |
| | | {
|
| | | //获取湿度传感器
|
| | | if (device is ZigBee.Device.TemperatureSensor && ((ZigBee.Device.TemperatureSensor)device).SensorDiv == 2)
|
| | | {
|
| | | listDevice.Add(device);
|
| | | }
|
| | | else if (device.Type == ZigBee.Device.DeviceType.FreshAirHumiditySensor)
|
| | | {
|
| | | listDevice.Add(device);
|
| | | }
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | foreach (var data in report.DeviceStatusReport.AttriBute)
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainKeys);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | decimal humidity = (decimal)localDevice.GetType().InvokeMember("Humidity", System.Reflection.BindingFlags.GetField, null, localDevice, null);
|
| | | if (humidity == 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (data.AttriButeData == 0)
|
| | | {
|
| | | //0
|
| | | btnHumi.Text = "0.0%";
|
| | | this.cloneRoom.Humidity = 0;
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位(湿度没有负数)
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | //记录湿度
|
| | | this.cloneRoom.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, "."));
|
| | | btnHumi.Text = this.cloneRoom.Humidity.ToString() + "%";
|
| | | }
|
| | | });
|
| | | //0
|
| | | btnHumi.Text = "0.0%";
|
| | | this.cloneRoom.Humidity = 0;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //记录湿度
|
| | | this.cloneRoom.Humidity = humidity;
|
| | | btnHumi.Text = this.cloneRoom.Humidity.ToString() + "%";
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | //发送获取湿度的命令
|
| | | ((ZigBee.Device.TemperatureSensor)device).ReadTemperatureOrHumidity();
|
| | | device.GetType().InvokeMember("ReadTemperatureOrHumidity", System.Reflection.BindingFlags.InvokeMethod, null, device, null);
|
| | | }
|
| | |
|
| | | #endregion
|