陈嘉乐
2020-05-18 5da99fed2eb0d08b6338064da5f998891252c7b8
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);
            //初始化中部控件
@@ -96,11 +96,13 @@
            this.ClearBodyFrame();
            //图片
            var btnPic = new PicViewControl(878, 478);
            btnPic.Y = Application.GetMinRealAverage(251);
            btnPic.Gravity = Gravity.CenterHorizontal;
            btnPic.UnSelectedImagePath = "Instruct/DeviceSearch.png";
            bodyFrameLayout.AddChidren(btnPic);
            var framePic = new FrameLayout();
            framePic.Width = this.GetPictrueRealSize(878);
            framePic.Height = this.GetPictrueRealSize(478);
            framePic.Y = Application.GetRealHeight(251);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.BackgroundImagePath = "Instruct/DeviceSearch.png";
            bodyFrameLayout.AddChidren(framePic);
            //正在搜索设备,请稍候…
            var btnSearch = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false);
@@ -142,13 +144,15 @@
            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();
            this.StartConcetionAnimeteThread(framePic);
        }
        #endregion
@@ -310,23 +314,23 @@
        /// <summary>
        /// 开启连接的假想动画效果线程
        /// </summary>
        private void StartConcetionAnimeteThread()
        private void StartConcetionAnimeteThread(FrameLayout framePic)
        {
            int iconSize = Application.GetMinRealAverage(23);
            int iconSize = this.GetPictrueRealSize(23);
            var listPoint = new List<int>();
            for (int i = 0; i < 9; i++)
            {
                //X轴+Index*(图标大小+间距)
                listPoint.Add(Application.GetMinRealAverage(394) + i * (iconSize + Application.GetMinRealAverage(10)));
                listPoint.Add(this.GetPictrueRealSize(300) + i * (iconSize + this.GetPictrueRealSize(10)));
            }
            var btnRound = new PicViewControl(iconSize, iconSize, false);
            btnRound.Radius = (uint)iconSize / 2;
            btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor;
            btnRound.X = listPoint[0];
            btnRound.Y = Application.GetMinRealAverage(475);
            bodyFrameLayout.AddChidren(btnRound);
            btnRound.Y = this.GetPictrueRealSize(225);
            framePic.AddChidren(btnRound);
            HdlThreadLogic.Current.RunThread(() =>
            {
@@ -571,15 +575,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();
        }