黄学彪
2019-11-18 1b565ce5fc003551b2db3a624f81221ac1df46b9
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceSearchForm.cs
@@ -45,6 +45,10 @@
        /// </summary>
        private string gatewayId = string.Empty;
        /// <summary>
        /// 真实网关
        /// </summary>
        private ZbGateway realGateway = null;
        /// <summary>
        /// 进度条
        /// </summary>
        private FrameLayout btnProgressBar = null;
@@ -73,6 +77,7 @@
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uAddDevice));
            this.gatewayId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
            HdlGatewayLogic.Current.GetRealGateway(ref this.realGateway, this.gatewayId);
            //初始化中部控件
            this.InitMiddleFrame();
@@ -144,13 +149,13 @@
                        return;
                    }
                    //让网关允许入网
                    GatewayResourse.NowSelectGateway.AddNewDeviceToGateway(255);
                    this.realGateway.AddNewDeviceToGateway(255);
                    System.Threading.Thread.Sleep(1000);
                }
            });
            //添加监视设备新上报的事件
            GatewayResourse.NowSelectGateway.GwResDataAction += this.AdjustGatewayResultData;
            this.realGateway.GwResDataAction += this.AdjustGatewayResultData;
        }
        #endregion
@@ -169,7 +174,7 @@
            if (result == -1)
            {
                //停止接收
                GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
                this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
                Application.RunOnMainThread(() =>
                {
@@ -206,7 +211,7 @@
                //给新设备设置主键属性
                Common.LocalDevice.Current.SetNewDeviceMainKeys(device, jobject);
                device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(GatewayResourse.NowSelectGateway);
                device.CurrentGateWayId = HdlGatewayLogic.Current.GetGatewayId(this.realGateway);
                //将DeviceInfo的属性设置到主属性中
                Common.LocalDevice.Current.SetDeviceInfoToMain(device, device);
@@ -261,7 +266,7 @@
                    this.waitDeviceTimeOut--;
                }
                //停止接收
                GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
                this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
                System.Threading.Thread.Sleep(500);
                //目前就弄一个
@@ -516,13 +521,13 @@
        {
            base.CloseForm();
            //停止接收
            GatewayResourse.NowSelectGateway.GwResDataAction -= this.AdjustGatewayResultData;
            this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
            HdlThreadLogic.Current.RunThread(() =>
            {
                System.Threading.Thread.Sleep(1200);
                //关闭入网模式
                GatewayResourse.NowSelectGateway.AddNewDeviceToGateway(0);
                this.realGateway.AddNewDeviceToGateway(0);
            });
        }