From fa6bcb2e9907772480f99205f36ec2a1ce735a22 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 09 一月 2020 14:11:07 +0800 Subject: [PATCH] 合并代码 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs | 84 +++++++++++++++++++++++++++++++++++------- 1 files changed, 70 insertions(+), 14 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs index b413b7b..2296aba 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs @@ -132,21 +132,10 @@ frame.AddChidren(listView); listView.BeginHeaderRefreshingAction += () => { - //涓嬫媺鍒锋柊 HdlThreadLogic.Current.RunThread(() => { - //鑾峰彇鍏ㄩ儴璁惧 - bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway); - HdlThreadLogic.Current.RunMain(() => - { - //闅愯棌涓嬫媺鍒锋柊鐗规晥 - listView.EndHeaderRefreshing(); - if (result == true) - { - //閲嶆柊鍒锋柊鐣岄潰 - this.InitMiddleFrame(false); - } - }); + //涓嬫媺鍒锋柊 + this.ListViewBeginHeaderRefreshing(); }); }; } @@ -175,6 +164,10 @@ //鏍规嵁MAC鍚堝苟璁惧鍒楄〃 this.MargeAllDeviceByMac(listDevice); + if (this.Parent == null) + { + return; + } HdlThreadLogic.Current.RunMain(() => { var listOta = new List<OTADevice>(); @@ -528,6 +521,60 @@ #endregion + #region 鈻� 涓嬫媺鍒锋柊___________________________ + + /// <summary> + /// 婊戝姩鎺т欢涓嬫媺鍒锋柊 + /// </summary> + private async void ListViewBeginHeaderRefreshing() + { + //濡傛灉鏄湪绾跨殑 + if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true) + { + //妫�娴嬪箍鎾埌鐨勮繖涓綉鍏虫槸鍚︽嫢鏈変綇瀹匢D + ZbGateway realWay = null; + if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true) + { + //閲嶆柊璁剧疆浣忓畢ID(杩欎釜搴旇鏄笉缁忚繃APP,鐩存帴鎶婄綉鍏虫仮澶嶄簡鍑哄巶璁剧疆) + if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true) + { + //鏄剧ず杩涘害鏉� + ProgressBar.Show(); + int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay); + //鍏抽棴杩涘害鏉� + ProgressBar.Close(); + if (result2 == -1) + { + return; + } + } + } + } + if (this.Parent == null) + { + return; + } + + //鑾峰彇鍏ㄩ儴璁惧 + int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway); + if (this.Parent == null) + { + return; + } + HdlThreadLogic.Current.RunMain(() => + { + //闅愯棌涓嬫媺鍒锋柊鐗规晥 + listView.EndHeaderRefreshing(); + if (result != -1) + { + //閲嶆柊鍒锋柊鐣岄潰 + this.InitMiddleFrame(false); + } + }); + } + + #endregion + #region 鈻� 缃戝叧鍦ㄧ嚎妫�娴媉______________________ /// <summary> @@ -625,7 +672,16 @@ { //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId); - var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO); + int statu = 0; + var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO); + if (statu != -1) + { + for (int i = 0; i < list.Count; i++) + { + //璁剧疆璁惧鍦ㄧ嚎鐘舵�� + this.ReceiveDeviceStatu(list[i]); + } + } }); } -- Gitblit v1.8.0