From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs | 109 ++++++++++++++++++++++++++++++------------------------
1 files changed, 60 insertions(+), 49 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
index 87b1643..f856377 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/Base/DeviceDetailCardCommonForm.cs
@@ -16,15 +16,19 @@
/// <summary>
/// 鐣岄潰鍏抽棴浜嬩欢
/// </summary>
- public Action<CommonDevice, Common.Room> FormCloseEvent = null;
+ public Action<CommonDevice> FormCloseEvent = null;
/// <summary>
/// 璁惧瀵硅薄
/// </summary>
public CommonDevice device = null;
/// <summary>
- /// 鎴块棿瀵硅薄
+ /// 褰撳墠閫夋嫨鐨勬埧闂村璞�(鍐嶆鍒锋柊鐣岄潰鏃�,杩欎釜涓滆タ鏈夊彲鑳芥槸null)
/// </summary>
- public Common.Room room = null;
+ public Common.Room nowSelectRoom = null;
+ /// <summary>
+ /// 鏍囪瀹冩槸鐢卞摢涓帶浠惰皟璧风殑
+ /// </summary>
+ public ViewGroup RowOrCardControl = null;
/// <summary>
/// 鐘舵�佹帶浠�
/// </summary>
@@ -40,7 +44,7 @@
/// <summary>
/// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋� 0:娌℃湁鑾峰彇寰楀埌 1:宸茬粡鑾峰彇寰楀埌
/// </summary>
- private int ResponeResult = 0;
+ public int ResponeResult = 0;
/// <summary>
/// 褰撳墠绔偣鐨勫姛鑳界被鍨�
/// </summary>
@@ -66,13 +70,13 @@
/// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
/// </summary>
/// <param name="i_device">璁惧瀵硅薄</param>
- /// <param name="i_room">鎴块棿</param>
+ /// <param name="i_nowSelectRoom">鎴块棿</param>
/// <param name="i_backWidth">鐧借壊鑳屾櫙鐨勫搴�(闈炵湡瀹炲��)</param>
/// <param name="i_backHeight">鐧借壊鑳屾櫙鐨勯珮搴�(闈炵湡瀹炲��)</param>
- public void ShowForm(CommonDevice i_device, Common.Room i_room, int i_backWidth, int i_backHeight)
+ public void ShowForm(CommonDevice i_device, Common.Room i_nowSelectRoom, int i_backWidth, int i_backHeight)
{
this.CurrentText = Language.StringByID(R.MyInternationalizationString.Current) + " ";
- this.room = i_room;
+ this.nowSelectRoom = i_nowSelectRoom;
this.backFrameWidth = i_backWidth;
this.backFrameHeight = i_backHeight;
@@ -84,7 +88,7 @@
btnMore.ButtonClickEvent += (sender, e) =>
{
var detailInfo = new DeviceDetailInfoForm();
- detailInfo.AddForm(device, room);
+ detailInfo.AddForm(device, nowSelectRoom);
};
//鍒濆鍖栦腑閮ㄤ俊鎭�
@@ -122,7 +126,7 @@
btnDeviceName.Y = Application.GetRealHeight(46);
btnDeviceName.TextSize = 15;
btnDeviceName.IsBold = true;
- btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+ btnDeviceName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(i_device);
btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
btnDeviceName.TextAlignment = TextAlignment.Center;
btnDeviceName.Gravity = Gravity.CenterHorizontal;
@@ -155,7 +159,7 @@
//鎴块棿鍥炬爣
var btnRoomIcon = new IconViewControl(81);
- btnRoomIcon.X = ControlCommonResourse.XXLeft;
+ btnRoomIcon.X = HdlControlResourse.XXLeft;
btnRoomIcon.UnSelectedImagePath = "Item/Room.png";
btnRoomIcon.Gravity = Gravity.CenterVertical;
frameRoomBlack.AddChidren(btnRoomIcon);
@@ -166,7 +170,15 @@
btnRoomName.TextSize = 12;
btnRoomName.TextColor = UserCenterColor.Current.White;
btnRoomName.Gravity = Gravity.CenterVertical;
- btnRoomName.Text = this.room.Name;
+ if (this.nowSelectRoom != null)
+ {
+ btnRoomName.Text = this.nowSelectRoom.Name;
+ }
+ else
+ {
+ //鏈垎閰�
+ btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
+ }
frameRoomBlack.AddChidren(btnRoomName);
//鏀惰棌
@@ -220,16 +232,14 @@
this.ResponeResult = 0;
//鍏堣鎸囧畾鎺т欢涓嶈兘鐐瑰嚮
- var listSelect = new List<bool>();
foreach (var myContr in listControl)
{
myContr.CanClick = false;
- listSelect.Add(myContr.IsSelected);
}
HdlThreadLogic.Current.RunThread(() =>
{
- int waitime = 30;
+ int waitime = 40;
while (waitime > 0)
{
System.Threading.Thread.Sleep(100);
@@ -239,22 +249,24 @@
break;
}
waitime--;
+ //2绉掔殑鏃跺��,杩樻槸鎺ュ彈涓嶅埌鐨勮瘽,寮哄埗鍐嶆鍒锋柊璁惧鐘舵��
+ if (waitime == 20)
+ {
+ //浠庢柊鍙戦�佽幏鍙栬澶囩殑鐘舵��(寮哄埗)
+ this.device.HadReadDeviceStatu = false;
+ if (this.RowOrCardControl != null)
+ {
+ this.RowOrCardControl.GetType().InvokeMember("SendStatuComand", System.Reflection.BindingFlags.InvokeMethod, null, this.RowOrCardControl, null);
+ }
+ }
}
- if (waitime <= 0)
+ if (waitime <= 0 && this.Parent != null)
{
//娌℃湁鑾峰彇寰楀埌缁撴灉
HdlThreadLogic.Current.RunMain(() =>
{
var msgContr = new ShowMsgControl(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.FAIL));
msgContr.Show();
- //鍙樻洿鍥炲師鏉ョ殑鐘舵��
- for (int i = 0; i < listSelect.Count; i++)
- {
- if (listSelect[i] != listControl[i].IsSelected)
- {
- listControl[i].IsSelected = listSelect[i];
- }
- }
});
}
//寮�鍏虫寜閽彲浠ュ啀鐐瑰嚮
@@ -283,27 +295,11 @@
/// </summary>
private void AddDeviceReportEvent()
{
- string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
- //鑺傜偣鍙嶉
- HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardControl" + mainKeys, ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, (report) =>
- {
- string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
- if (mainKeys != mainKey2)
- {
- //涓嶆槸鍚屼竴涓笢瑗�
- return;
- }
- //妫�娴嬬粨鏋�
- if (this.CheckResponeResultStatu(ReceiveComandDiv.A鑺傜偣鎺у埗鍙嶉, report) == true)
- {
- //缁撴灉宸茬粡鎺ユ敹鍒�
- this.ResponeResult = 1;
- }
- });
+ string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.device);
//灞炴�т笂鎶�
HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceDetailCardAttribute" + mainKeys, ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (report) =>
{
- string mainKey2 = Common.LocalDevice.Current.GetDeviceMainKeys(report);
+ string mainKey2 = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
if (mainKeys != mainKey2)
{
//涓嶆槸鍚屼竴涓笢瑗�
@@ -328,9 +324,9 @@
public override int FormActionAgainEvent()
{
//濡傛灉涓嶆槸鍠滅埍鎴块棿鐨勮瘽,瀹冪殑鎴块棿鏈夊彲鑳借鍒囨崲浜�
- if (this.room.IsLove == false)
+ if (this.nowSelectRoom == null || this.nowSelectRoom.IsLove == false)
{
- this.room = HdlRoomLogic.Current.GetRoomByDevice(this.device);
+ this.nowSelectRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device);
}
//濡傛灉鍔熻兘绫诲瀷鍙樻洿浜�
if (this.nowDeviceFuncType != this.device.DfunctionType)
@@ -341,11 +337,18 @@
else
{
//鍒锋柊鍚嶅瓧
- this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(this.device);
+ this.btnDeviceName.Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(this.device);
btnDeviceName.Width = btnDeviceName.GetRealWidthByText();
btnDeviceName.Gravity = Gravity.CenterHorizontal;
-
- this.btnRoomName.Text = this.room.Name;
+ if (this.nowSelectRoom == null)
+ {
+ //鏈垎閰�
+ this.btnRoomName.TextID = R.MyInternationalizationString.uDeviceNotAssignedRoom;
+ }
+ else
+ {
+ this.btnRoomName.Text = this.nowSelectRoom.Name;
+ }
}
return 1;
@@ -360,12 +363,11 @@
/// </summary>
public override void CloseFormBefore()
{
- string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(this.device);
- HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardControl" + mainKeys);
+ string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.device);
HdlGatewayReceiveLogic.Current.RemoveEvent("DeviceDetailCardAttribute" + mainKeys);
//鍥炶皟鍑芥暟
- this.FormCloseEvent?.Invoke(this.device, this.room);
+ this.FormCloseEvent?.Invoke(this.device);
this.FormCloseEvent = null;
base.CloseFormBefore();
@@ -385,6 +387,15 @@
}
/// <summary>
+ /// 璁剧疆PM2.5浼犳劅鍣ㄧ姸鎬佹枃鏈�(涓嶉渶瑕佹寚瀹氥�愬綋鍓嶄袱涓瓧銆�)
+ /// </summary>
+ /// <param name="text"></param>
+ public void SetPmTwoPointFiveStatuText(string text)
+ {
+ this.btnStatu.Text = text;
+ }
+
+ /// <summary>
/// 閲嶆柊璁剧疆璁惧鍚嶅瓧鎺т欢鍜岀姸鎬佹帶浠剁殑Y杞�
/// </summary>
/// <param name="i_NameY">璁惧鍚嶅瓧鎺т欢鐨刌杞�(鐪熷疄鍊�)</param>
--
Gitblit v1.8.0