陈嘉乐
2020-04-27 18b93d511dc764b469d7c4a7e755f7274f89cdb4
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();
        }