From b7b3e92bed9c4553e30e2901a1877f088a5f8823 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 04 十一月 2019 17:20:52 +0800
Subject: [PATCH] 2019.11.4
---
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 62 +++++++++++++++++-------------
1 files changed, 35 insertions(+), 27 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 2d698b8..6d2082c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -95,12 +95,11 @@
//鍒濆鍖栨悳绱㈡帶浠�
this.InitSearchControl();
- new System.Threading.Thread(() =>
+ HdlThreadLogic.Current.RunThread(() =>
{
//鍒濆鍖栬澶囧垪琛ㄦ帶浠�
this.InitDeviceListControl();
- })
- { IsBackground = true }.Start();
+ });
}
#endregion
@@ -304,7 +303,10 @@
private void AddDeviceDetailRow(FrameListControl frame, CommonDevice device)
{
var rowInfo = this.dicRowInfo[device.DeviceAddr];
- rowInfo.dicDetailRow = new Dictionary<string, DeviceRoomControl>();
+ if (rowInfo.dicDetailRow == null)
+ {
+ rowInfo.dicDetailRow = new Dictionary<string, DeviceRoomControl>();
+ }
//琛屾帶浠�
var rowDevice = new DeviceRoomControl(device, frame.rowSpace / 2);
@@ -315,6 +317,8 @@
rowDevice.frameTable.AddBottomLine();
//鍙崇澶�
rowDevice.frameTable.AddRightArrow();
+ //鍦ㄧ嚎鐘舵��
+ rowDevice.isOnline = device.IsOnline == 1;
//淇濆瓨鎺т欢
string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
@@ -416,7 +420,7 @@
}
string selectGwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
- new System.Threading.Thread(() =>
+ HdlThreadLogic.Current.RunThread(() =>
{
ZbGateway zbGateway = HdlGatewayLogic.Current.GetLocalGateway(selectGwId);
if (zbGateway == null)
@@ -436,8 +440,7 @@
this.StartDeviceListControlThread(online);
}
});
- })
- { IsBackground = true }.Start();
+ });
}
/// <summary>
@@ -519,33 +522,32 @@
return;
}
string gwId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
- new System.Threading.Thread(async () =>
+ HdlThreadLogic.Current.RunThread(async () =>
{
//杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵��
var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
- var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, this.ReceiveDeviceStatuPush);
- })
- { IsBackground = true }.Start();
+ var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
+ });
}
/// <summary>
- /// 鎺ュ彈璁惧鍦ㄧ嚎鎺ㄩ�侊紙缃戝叧鍦ㄧ嚎鎺ㄩ�佸嵆鍦ㄧ嚎锛�
+ /// 鎺ュ彈璁惧鍦ㄧ嚎鎺ㄩ��
/// </summary>
/// <param name="device"></param>
private void ReceiveDeviceStatuPush(CommonDevice device)
{
lock (dicRowInfo)
{
- if (device == null || this.Parent == null)
+ if (this.Parent == null)
{
return;
}
- DeviceObjectControl row = null;
+ DeviceObjRowInfo rowInfo = null;
if (this.dicRowInfo.ContainsKey(device.DeviceAddr) == true)
{
- row = this.dicRowInfo[device.DeviceAddr].MenuRow;
+ rowInfo = this.dicRowInfo[device.DeviceAddr];
}
- if (row == null)
+ if (rowInfo == null || rowInfo.MenuRow == null)
{
return;
}
@@ -564,11 +566,18 @@
localDevice.ReSave();
}
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
- if (row != null)
+ if (rowInfo != null)
{
- row.isOnline = device.IsOnline == 1;
+ rowInfo.MenuRow.isOnline = device.IsOnline == 1;
+ if (rowInfo.dicDetailRow != null)
+ {
+ foreach (var detailRow in rowInfo.dicDetailRow.Values)
+ {
+ detailRow.isOnline = rowInfo.MenuRow.isOnline;
+ }
+ }
}
});
}
@@ -604,7 +613,7 @@
/// <param name="list">ota璁惧</param>
private void CheckDeviceNewVersion(List<OTADevice> list)
{
- new System.Threading.Thread(async () =>
+ HdlThreadLogic.Current.RunThread(async () =>
{
await System.Threading.Tasks.Task.Delay(2000);
foreach (var ota in list)
@@ -644,8 +653,7 @@
}
});
}
- })
- { IsBackground = true }.Start();
+ });
}
#endregion
@@ -711,11 +719,9 @@
/// <param name="listDevice"></param>
private void MargeAllDeviceByMac(List<CommonDevice> listDevice)
{
- //璁惧鎺掑簭
- List<CommonDevice> listSort = Common.LocalDevice.Current.SortDeviceList(listDevice);
//鏍规嵁Mac鍏ㄩ儴鍒嗙粍
var dic = new Dictionary<string, List<CommonDevice>>();
- foreach (CommonDevice device in listSort)
+ foreach (CommonDevice device in listDevice)
{
if (device == null || device.DeviceAddr == null)
{
@@ -762,11 +768,11 @@
/// <summary>
/// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
/// </summary>
- public override void FormActionAgainEvent()
+ public override int FormActionAgainEvent()
{
if (this.nowActionDeviceMac == null)
{
- return;
+ return 1;
}
var rowInfo = this.dicRowInfo[nowActionDeviceMac];
//妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎
@@ -795,6 +801,8 @@
this.nowActionDeviceMac = null;
//缃戝叧鎺т欢鍒锋柊
this.gatewayViewRow.RefreshControl();
+
+ return 1;
}
#endregion
--
Gitblit v1.8.0