From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 27 四月 2020 17:55:14 +0800 Subject: [PATCH] 2020-4-27-1 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs index 4102a31..b929a2f 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs @@ -80,7 +80,7 @@ //璁剧疆鏍囬淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice)); - this.gatewayId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway); + this.gatewayId = GatewayResourse.NowSelectGatewayId; HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId); //鍒濆鍖栦腑閮ㄦ帶浠� @@ -142,11 +142,13 @@ btnProgressView.Text = "0%"; frameProgress.AddChidren(btnProgressView); - //鍏佽璁惧鍏ョ綉 - this.StartDeviceCanAddToGateway(false); - - //娣诲姞鐩戣璁惧鏂颁笂鎶ョ殑浜嬩欢 - this.realGateway.GwResDataAction += this.AdjustGatewayResultData; + if (this.realGateway != null) + { + //鍏佽璁惧鍏ョ綉 + this.StartDeviceCanAddToGateway(false); + //娣诲姞鐩戣璁惧鏂颁笂鎶ョ殑浜嬩欢 + this.realGateway.GwResDataAction += this.AdjustGatewayResultData; + } //寮�鍚繛鎺ョ殑鍋囨兂鍔ㄧ敾鏁堟灉绾跨▼ this.StartConcetionAnimeteThread(); } @@ -571,15 +573,18 @@ /// </summary> public override void CloseFormBefore() { - //鍋滄鎺ユ敹 - this.realGateway.GwResDataAction -= this.AdjustGatewayResultData; - - HdlThreadLogic.Current.RunThread(() => + if (this.realGateway != null) { - System.Threading.Thread.Sleep(1200); - //鍏抽棴鍏ョ綉妯″紡 - this.realGateway.AddNewDeviceToGateway(0); - }); + //鍋滄鎺ユ敹 + this.realGateway.GwResDataAction -= this.AdjustGatewayResultData; + + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(1200); + //鍏抽棴鍏ョ綉妯″紡 + this.realGateway.AddNewDeviceToGateway(0); + }); + } base.CloseFormBefore(); } -- Gitblit v1.8.0