From e28d283bd27db2c40ff435c517db54e2010e8ae6 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 24 十二月 2019 14:31:56 +0800
Subject: [PATCH] 2019.12.24
---
ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs | 37 +++++++++++++++++++++----------------
1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
index 667f29f..e620358 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/RoomView.cs
@@ -18,8 +18,8 @@
public override void RemoveFromParent()
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
base.RemoveFromParent();
}
@@ -83,7 +83,7 @@
{
X = Application.GetRealWidth(29),
Y = Application.GetRealHeight(374),
- Width = Application.GetRealWidth(340),
+ Width = Application.GetRealWidth(400),
Height = Application.GetRealHeight(80),
BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor2
};
@@ -103,16 +103,16 @@
var temperatureText = new Button
{
X = Application.GetRealWidth(69),
- Width = Application.GetRealWidth(86),
+ Width = Application.GetRealWidth(120),
Height = Application.GetRealHeight(58),
Gravity = Gravity.CenterVertical,
- Text = "26鈩�"
+ Text = $"{room.Temperatrue}鈩�"
};
roomTemperatureBackground.AddChidren(temperatureText);
var humidityIcon = new Button
{
- X = Application.GetRealWidth(179),
+ X = Application.GetRealWidth(200),
Width = Application.GetMinRealAverage(58),
Height = Application.GetMinRealAverage(58),
Gravity = Gravity.CenterVertical,
@@ -122,19 +122,19 @@
var humidityText = new Button
{
- X = Application.GetRealWidth(236),
- Width = Application.GetRealWidth(86),
+ X = Application.GetRealWidth(260),
+ Width = Application.GetRealWidth(120),
Height = Application.GetRealHeight(58),
Gravity = Gravity.CenterVertical,
- Text = "13%"
+ Text = $"{room.Humidity}%"
};
roomTemperatureBackground.AddChidren(humidityText);
if (string.IsNullOrEmpty(room.TemperatrueDevice) == false)
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("TemperatrueDevice", "DeviceStatusReport", (Action<ZigBee.Device.CommonDevice>)((report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("TemperatrueDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (Action<ZigBee.Device.CommonDevice>)((report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.TemperatrueDevice != mainKeys)
@@ -142,7 +142,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("TemperatrueDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("TemperatrueDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
@@ -152,6 +152,7 @@
{
//0鈩�
temperatureText.Text = "0.0鈩�";
+ room.Temperatrue = 0;
}
else if (data.AttriButeData > 32767)
{
@@ -160,6 +161,7 @@
//灏忔暟鐐归渶瑕佷竴浣�
strValue = strValue.Substring(0, strValue.Length - 1);
temperatureText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+ room.Temperatrue = int.Parse(strValue) * 0.1;
}
else
{
@@ -167,6 +169,7 @@
string strValue = data.AttriButeData.ToString();
strValue = strValue.Substring(0, strValue.Length - 1);
temperatureText.Text = strValue.Insert(strValue.Length - 1, ".") + "鈩�";
+ room.Temperatrue = int.Parse(strValue) * 0.1;
}
}
}
@@ -181,8 +184,8 @@
if (string.IsNullOrEmpty(room.HumidityDevice) == false)
{
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
- HdlDeviceAttributeLogic.Current.AddAttributeEvent("HumidityDevice", "DeviceStatusReport", (report) =>
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.AddAttributeEvent("HumidityDevice", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
{
string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
if (room.HumidityDevice != mainKeys)
@@ -190,7 +193,7 @@
return;
}
//绉婚櫎鎺変簨浠�
- HdlDeviceAttributeLogic.Current.RemoveEvent("HumidityDevice");
+ HdlGatewayReceiveLogic.Current.RemoveEvent("HumidityDevice");
foreach (var data in report.DeviceStatusReport.AttriBute)
{
if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue)
@@ -199,6 +202,7 @@
{
//0
humidityText.Text = "0.0%";
+ room.Humidity = 0;
}
else
{
@@ -206,6 +210,7 @@
string strValue = data.AttriButeData.ToString();
strValue = strValue.Substring(0, strValue.Length - 1);
humidityText.Text = strValue.Insert(strValue.Length - 1, ".") + "%";
+ room.Humidity = int.Parse(strValue) * 0.1;
}
}
}
@@ -217,6 +222,7 @@
(dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity();
}
}
+
var roomListBtn = new Button()
{
@@ -240,7 +246,6 @@
action?.Invoke();
};
};
-
}
}
}
--
Gitblit v1.8.0