From c6b35c3138b944830b5336bf610f918154dd47c7 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期六, 12 十月 2019 15:45:10 +0800 Subject: [PATCH] 合并门锁,完成住宅管理 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index f86a187..6d2082c 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -303,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); @@ -314,6 +317,8 @@ rowDevice.frameTable.AddBottomLine(); //鍙崇澶� rowDevice.frameTable.AddRightArrow(); + //鍦ㄧ嚎鐘舵�� + rowDevice.isOnline = device.IsOnline == 1; //淇濆瓨鎺т欢 string maikey = Common.LocalDevice.Current.GetDeviceMainKeys(device); @@ -521,28 +526,28 @@ { //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId); - var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, this.ReceiveDeviceStatuPush); + 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; } @@ -561,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; + } + } } }); } @@ -707,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) { -- Gitblit v1.8.0