陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayListForm.cs
@@ -95,15 +95,12 @@
            for (int i = 0; i < listway.Count; i++)
            {
                //添加行
                var gwId = HdlGatewayLogic.Current.GetGatewayId(listway[i]);
                this.AddRowLayout(gwId, i != listway.Count - 1);
                this.AddRowLayout(listway[i].GwId, i != listway.Count - 1);
            }
            //调整列表控件的高度
            this.listview.AdjustRealHeight(Application.GetRealHeight(23));
            //设置接受在线状态推送
            this.AddGatewayOnlinePush();
            //开启网关在线监测的线程
            this.StartGatewayOnlieCheckThread(listway);
        }
@@ -133,11 +130,18 @@
            //提示新版本
            var btnNew = new InformationTipView(gatewayRow.btnIcon);
            btnNew.Visible = false;
            gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
            gatewayRow.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent);
            gatewayRow.AddTag("btnNew", btnNew);
            //单击事件
            gatewayRow.frameTable.ButtonClickEvent += (sender, e) =>
            {
                if (UserCenterResourse.HideOption.GotoGatewayProductInfoForm == 1)
                {
                    //强制跳转
                    var form2 = new GatewayProductInfoForm();
                    form2.AddForm(gateway);
                    return;
                }
                var form = new GatewayInfoEditorForm();
                form.AddForm(gateway);
            };
@@ -174,13 +178,8 @@
            };
            //定位
            var btnPosition = new NormalViewControl(Application.GetRealWidth(184), gatewayRow.Height, false);
            btnPosition.BackgroundColor = 0xff4a4a4a;
            btnPosition.TextAlignment = TextAlignment.Center;
            btnPosition.TextColor = UserCenterColor.Current.White;
            btnPosition.TextSize = 12;
            var btnPosition = gatewayRow.AddEditorControl(false);
            btnPosition.TextID = R.MyInternationalizationString.uFixedPosition;
            gatewayRow.AddRightView(btnPosition);
            btnPosition.ButtonClickEvent += (sender, e) =>
            {
                //发送定位命令
@@ -205,7 +204,10 @@
                }
                this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                {
                    this.DeleteGateway(strWayId, gatewayRow);
                    HdlThreadLogic.Current.RunThread(() =>
                    {
                        this.DeleteGateway(strWayId, gatewayRow);
                    });
                });
            };
@@ -214,6 +216,16 @@
            if (string.IsNullOrEmpty(GatewayResourse.AppOldSelectGatewayId) == true)
            {
                HdlGatewayLogic.Current.SaveGatewayIdToLocation(strWayId);
            }
            //当前网关的角标
            if (strWayId == GatewayResourse.AppOldSelectGatewayId)
            {
                var btnNow = new IconViewControl(52);
                btnNow.Y = Application.GetMinReal(23) + gatewayRow.frameTable.chidrenYaxis;
                btnNow.UnSelectedImagePath = "Item/NowAcctionTip.png";
                btnNow.X = gatewayRow.btnName.X + gatewayRow.btnName.GetRealWidthByText();
                gatewayRow.frameTable.AddChidren(btnNow, ChidrenBindMode.BindEvent);
            }
        }
@@ -228,8 +240,12 @@
        /// <param name="row"></param>
        private async void DeleteGateway(string strWayId, GatewayRowControl row)
        {
            //打开进度条
            this.ShowProgressBar();
            //删除云端网关
            bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId);
            //关闭进度条
            this.CloseProgressBar();
            if (result == false)
            {
                return;
@@ -241,13 +257,11 @@
                this.closeDeviceManagForm = true;
                HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty);
            }
            //移除
            if (this.dicRowContr.ContainsKey(strWayId) == true)
            HdlThreadLogic.Current.RunMain(() =>
            {
                this.dicRowContr.Remove(strWayId);
            }
            row?.RemoveFromParent();
                //初始化中部控件
                this.InitMiddleFrame();
            });
        }
        #endregion
@@ -282,7 +296,7 @@
                    //关闭界面
                    this.CloseForm();
                    //刷新主画面(不重新获取设备状态)
                    this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false);
                    this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame");
                }
            });
        }
@@ -325,7 +339,7 @@
                        return;
                    }
                    bool online = HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(way);
                    this.GatewayOnlinePush(way, online);
                    this.GatewayOnlinePush(way, online, true);
                }
                //网关新版本检测
                this.CheckGatewayNewVersion(listway);
@@ -337,7 +351,8 @@
        /// </summary>
        /// <param name="gateWay">网关对象</param>
        /// <param name="online">在线状态变更后的状态</param>
        public override void GatewayOnlinePush(ZbGateway gateWay, bool online)
        /// <param name="hadGwOnline">2020.05.25追加:此住宅是否拥有网关在线</param>
        public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline)
        {
            Application.RunOnMainThread(() =>
            {
@@ -345,10 +360,10 @@
                {
                    return;
                }
                string gwid = HdlGatewayLogic.Current.GetGatewayId(gateWay);
                string gwid = gateWay.GwId;
                if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null)
                {
                    this.dicRowContr[gwid].RefreshControl(gateWay);
                    this.dicRowContr[gwid].IsOnline = online;
                }
            });
        }
@@ -383,7 +398,7 @@
                if (result[0] != null || result[1] != null || result[2] != null)
                {
                    //有新版本
                    string gwid = HdlGatewayLogic.Current.GetGatewayId(way);
                    string gwid = way.GwId;
                    Application.RunOnMainThread(() =>
                    {
                        if (this.dicRowContr.ContainsKey(gwid) == true && this.dicRowContr[gwid] != null)
@@ -406,9 +421,9 @@
        /// <summary>
        /// 画面关闭
        /// </summary>
        public override void CloseForm()
        public override void CloseFormBefore()
        {
            base.CloseForm();
            base.CloseFormBefore();
            if (this.closeDeviceManagForm == true)
            {