| | |
| | | btnTemper.Text = Language.StringByID(R.MyInternationalizationString.uGetting);
|
| | |
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A设备属性上报, (Action<ZigBee.Device.CommonDevice>)((report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A设备属性上报, ((report) =>
|
| | | {
|
| | | string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (cloneRoom.TemperatrueDevice != mainKeys || btnTemper == null)
|
| | |
| | | {
|
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | if (data.AttriButeData == 0)
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //0℃
|
| | | btnTemper.Text = "0.0℃";
|
| | | }
|
| | | else if (data.AttriButeData > 32767)
|
| | | {
|
| | | //负数(特殊处理)
|
| | | string strValue = (data.AttriButeData - 65536).ToString();
|
| | | //小数点需要一位
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnTemper.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnTemper.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
|
| | | }
|
| | | if (data.AttriButeData == 0)
|
| | | {
|
| | | //0℃
|
| | | btnTemper.Text = "0.0℃";
|
| | | }
|
| | | else if (data.AttriButeData > 32767)
|
| | | {
|
| | | //负数(特殊处理)
|
| | | string strValue = (data.AttriButeData - 65536).ToString();
|
| | | //小数点需要一位
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnTemper.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnTemper.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | }));
|
| | |
| | | {
|
| | | if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
|
| | | {
|
| | | if (data.AttriButeData == 0)
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //0
|
| | | btnHumi.Text = "0.0%";
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位(湿度没有负数)
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnHumi.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
|
| | | }
|
| | | if (data.AttriButeData == 0)
|
| | | {
|
| | | //0
|
| | | btnHumi.Text = "0.0%";
|
| | | }
|
| | | else
|
| | | {
|
| | | //小数点需要一位(湿度没有负数)
|
| | | string strValue = data.AttriButeData.ToString();
|
| | | strValue = strValue.Substring(0, strValue.Length - 1);
|
| | | btnHumi.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|