陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewaySearchForm.cs
@@ -60,9 +60,9 @@
            //图标
            var picGwImage = new FrameLayout();
            picGwImage.Width = Application.GetMinRealAverage(861);
            picGwImage.Height = Application.GetMinRealAverage(478);
            picGwImage.Y = Application.GetRealWidth(251);
            picGwImage.Width = this.GetPictrueRealSize(861);
            picGwImage.Height = this.GetPictrueRealSize(478);
            picGwImage.Y = Application.GetRealHeight(251);
            picGwImage.Gravity = Gravity.CenterHorizontal;
            picGwImage.BackgroundImagePath = "Gateway/WiredGatewaySearching.png";
            bodyFrameLayout.AddChidren(picGwImage);
@@ -89,8 +89,8 @@
            //图标
            var picGwImage = new FrameLayout();
            picGwImage.Width = Application.GetMinRealAverage(861);
            picGwImage.Height = Application.GetMinRealAverage(478);
            picGwImage.Width = this.GetPictrueRealSize(861);
            picGwImage.Height = this.GetPictrueRealSize(478);
            picGwImage.Y = Application.GetRealWidth(158);
            picGwImage.Gravity = Gravity.CenterHorizontal;
            picGwImage.BackgroundImagePath = "Gateway/WiredGatewaySearching.png";
@@ -98,12 +98,12 @@
            var btnFailIcon = new PicViewControl(66, 66);
            btnFailIcon.UnSelectedImagePath = "Item/FailIcon.png";
            btnFailIcon.Gravity = Gravity.CenterHorizontal;
            btnFailIcon.Y = Application.GetMinRealAverage(181);
            btnFailIcon.Y = this.GetPictrueRealSize(181);
            picGwImage.AddChidren(btnFailIcon);
            //搜索失败
            var btnFailView = new NormalViewControl(300, 60, true);
            btnFailView.TextAlignment = TextAlignment.Center;
            btnFailView.Y = Application.GetMinRealAverage(305);
            btnFailView.Y = this.GetPictrueRealSize(305);
            btnFailView.Gravity = Gravity.CenterHorizontal;
            btnFailView.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnFailView.TextID = R.MyInternationalizationString.uSearchFail;
@@ -115,7 +115,7 @@
            btnMsg1.Y = picGwImage.Bottom + Application.GetRealHeight(112);
            btnMsg1.TextID = R.MyInternationalizationString.uSearchGatewayFailMsg1;
            bodyFrameLayout.AddChidren(btnMsg1);
            //1.长按ZB/RST键20秒,网关恢复出厂设置,指示灯全部熄灭后,重新入网。
            //1.短按HID/WCFG按键,系统指示灯快闪3秒,网关进入换绑模式,强制网关绑定到当前APP
            var btnMsg2 = new NormalViewControl(930, 100, true);
            btnMsg2.X = Application.GetRealWidth(75);
            btnMsg2.Y = btnMsg1.Bottom + Application.GetRealHeight(35);
@@ -124,7 +124,7 @@
            btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnMsg2.IsMoreLines = true;
            bodyFrameLayout.AddChidren(btnMsg2);
            //2.点按HID/WCFG键,进入网关换绑模式,系统指示灯快闪5秒。
            //2.长按网关ZB/RST按键20秒以上,直到所有指示灯同时灭,即恢复出厂设置并重启
            var btnMsg3 = new NormalViewControl(930, 100, true);
            btnMsg3.X = Application.GetRealWidth(75);
            btnMsg3.Y = btnMsg2.Bottom + Application.GetRealHeight(12);
@@ -151,7 +151,7 @@
            bodyFrameLayout.AddChidren(btnMsg5);
            //重试
            var frameback = new FrameLayoutControl();
            var frameback = new FrameLayoutStatuControl();
            frameback.UseClickStatu = false;
            frameback.Y = Application.GetRealHeight(1259);
            frameback.Gravity = Gravity.CenterHorizontal;
@@ -160,13 +160,14 @@
            frameback.BackgroundImagePath = "Item/BottomButtonGround.png";
            bodyFrameLayout.AddChidren(frameback);
            var btnReDo = new NormalViewControl(300, 65, true);
            btnReDo.IsBold = true;
            btnReDo.TextColor = UserCenterColor.Current.White;
            btnReDo.TextSize = 16;
            btnReDo.Y = Application.GetRealHeight(49);
            btnReDo.Gravity = Gravity.CenterHorizontal;
            btnReDo.TextAlignment = TextAlignment.Center;
            btnReDo.TextID = R.MyInternationalizationString.uReDoAgain;
            frameback.AddChidren(btnReDo, ChidrenBindMode.BindEventOnly);
            frameback.AddChidren(btnReDo, ChidrenBindMode.BindEvent);
            frameback.ButtonClickEvent += (sender, e) =>
            {
                //初始化初始中部控件
@@ -201,11 +202,11 @@
        private void InitConcetionAnimete(FrameLayout picGwImage, NormalViewControl btnMsg)
        {
            //首格的X轴
            int firstPoint = Application.GetMinRealAverage(288);
            int firstPoint = this.GetPictrueRealSize(288);
            //一格的宽度
            int width = Application.GetMinRealAverage(22);
            int width = this.GetPictrueRealSize(22);
            //间距大小
            int space = Application.GetMinRealAverage(12);
            int space = this.GetPictrueRealSize(12);
            //生成格子坐标
            var listPoint = new List<int>();
@@ -218,7 +219,7 @@
            var btnRound = new PicViewControl(width, width, false);
            btnRound.Radius = (uint)width / 2;
            btnRound.BackgroundColor = UserCenterColor.Current.ConcetionRoundColor;
            btnRound.Y = Application.GetMinRealAverage(202);
            btnRound.Y = this.GetPictrueRealSize(202);
            btnRound.X = listPoint[0];
            picGwImage.AddChidren(btnRound);
@@ -314,12 +315,12 @@
            List<string> listId = new List<string>();
            for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
            {
                if (ZbGateway.GateWayList[i].getGatewayBaseInfo.IpAddress == string.Empty)
                if (ZbGateway.GateWayList[i].GwIP == string.Empty)
                {
                    //IP没有的网关,我也不知道它是干嘛的
                    continue;
                }
                string gwId = HdlGatewayLogic.Current.GetGatewayId(ZbGateway.GateWayList[i]);
                string gwId = ZbGateway.GateWayList[i].GwId;
                //重复添加检测
                if (this.dicIdCheckCount.ContainsKey(gwId) == false)
                {
@@ -341,7 +342,7 @@
            }
            for (int i = 0; i < listId.Count; i++)
            {
                ZbGateway way = ZbGateway.GateWayList.Find((obj) => HdlGatewayLogic.Current.GetGatewayId(obj) == listId[i]);
                ZbGateway way = ZbGateway.GateWayList.Find((obj) => obj.GwId == listId[i]);
                if (way == null)
                {
                    continue;
@@ -351,9 +352,9 @@
                GatewayBindMode mode = GatewayBindMode.BindAgain;
                //如果是第一次绑定,或者是以前已经绑定过了的
                if (HdlGatewayLogic.Current.HomeIdIsEmpty(way) == true
                    || way.getGatewayBaseInfo.HomeId == Common.Config.Instance.HomeId)
                    || way.HomeId == Common.Config.Instance.HomeId)
                {
                    if (way.getGatewayBaseInfo.HomeId != Common.Config.Instance.HomeId)
                    if (way.HomeId != Common.Config.Instance.HomeId)
                    {
                        //第一次绑定,也就是网关住宅ID为空
                        mode = GatewayBindMode.First;
@@ -394,6 +395,8 @@
                {
                    //需要重新绑定
                    this.dicZbGatewayDiv[listId[i]] = 2;
                    //获取到了新网关
                    this.newGatewayGetting = true;
                }
                if (mode == GatewayBindMode.First)
@@ -415,29 +418,7 @@
        public override void CloseFormBefore()
        {
            ZigBee.Common.Application.IsSearchingGateway = false;
            //断开没有执行绑定的网关的mqtt
            var list = new List<ZbGateway>();
            for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
            {
                if (HdlGatewayLogic.Current.IsGatewayExist(ZbGateway.GateWayList[i]) == false)
                {
                    list.Add(ZbGateway.GateWayList[i]);
                }
            }
            if (list.Count > 0)
            {
                foreach (var way in list)
                {
                    ZbGateway.GateWayList.RemoveAll((obj) => HdlGatewayLogic.Current.GetGatewayId(obj) == HdlGatewayLogic.Current.GetGatewayId(way));
                    way.DisConnect("Search");
                }
            }
            if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == false)
            {
                //刷新主页
                UserView.UserPage.Instance.Fresh();
            }
            base.CloseFormBefore();
        }