陈嘉乐
2020-09-02 652243206427f35a256400a149a1734085824cb9
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs
@@ -74,23 +74,28 @@
            btnNote.InitControl();
            //划线
            btnNote.AddBottomLine();
            btnNote.txtInput.FinishInputEvent += () =>
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == false)
            {
                string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway);
                if (btnNote.Text == string.Empty)
                btnNote.txtInput.FinishInputEvent += () =>
                {
                    btnNote.Text = oldName;
                }
                if (oldName != btnNote.Text)
                {
                    //修改名字
                    this.SetGatewayName(btnNote.Text, false);
                }
            };
                    string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway);
                    if (btnNote.Text == string.Empty)
                    {
                        btnNote.Text = oldName;
                    }
                    if (oldName != btnNote.Text)
                    {
                        //修改名字
                        this.SetGatewayName(btnNote.Text, false);
                    }
                };
            }
            //设备类型 (固定智能网关)
            caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
            var btnType = new FrameCaptionViewControl(caption, Language.StringByID(60004), listview.rowSpace / 2);
            var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("1");
            var btnType = new FrameCaptionViewControl(caption, infoContent != null ? infoContent.A类型名字 : string.Empty, listview.rowSpace / 2);
            btnType.UseClickStatu = false;
            listview.AddChidren(btnType);
            btnType.InitControl();
@@ -106,8 +111,13 @@
            rowBeloneArea.SelectRoomEvent += (roomKeys) =>
            {
                //变更网关房间
                HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys);
                HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway.GwId, roomKeys);
            };
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == true)
            {
                rowBeloneArea.CanClick = false;
            }
            //所属住宅
            caption = Language.StringByID(R.MyInternationalizationString.uBelongResidence);
@@ -144,11 +154,15 @@
                    rowFunction.frameTable.AddRightArrow();
                    //底线
                    rowFunction.frameTable.AddBottomLine();
                    rowFunction.frameTable.ButtonClickEvent += (sender, e) =>
                    //如果是展示模板的话,不能编辑
                    if (Common.Config.Instance.Home.IsShowTemplate == false)
                    {
                        var form = new DeviceLight.MiniNightLightFunctionSettionForm();
                        form.AddForm(miniDevice);
                    };
                        rowFunction.frameTable.ButtonClickEvent += (sender, e) =>
                        {
                            var form = new DeviceLight.MiniNightLightFunctionSettionForm();
                            form.AddForm(miniDevice);
                        };
                    }
                }
            }
@@ -160,11 +174,15 @@
            rowData.frameTable.AddRightArrow();
            //底线
            rowData.frameTable.AddBottomLine();
            rowData.frameTable.ButtonClickEvent += (sender, e) =>
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == false)
            {
                var form = new GatewayUploadAndDownLoadForm();
                form.AddForm(this.zbGateway.GwId);
            };
                rowData.frameTable.ButtonClickEvent += (sender, e) =>
                {
                    var form = new GatewayUploadAndDownLoadForm();
                    form.AddForm(this.zbGateway.GwId);
                };
            }
            //通用信息
            var btnGeneral = new FrameRowControl(listview.rowSpace / 2);
@@ -210,6 +228,11 @@
            var btnFinish = new BottomClickButton();
            btnFinish.TextID = R.MyInternationalizationString.uSave;
            bodyFrameLayout.AddChidren(btnFinish);
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == true)
            {
                btnFinish.CanClick = false;
            }
            btnFinish.ButtonClickEvent += (sender, e) =>
            {
                string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway);
@@ -229,11 +252,15 @@
                }
            };
            HdlThreadLogic.Current.RunThread(() =>
            //如果是展示模板的话,不需要检测
            if (Common.Config.Instance.Home.IsShowTemplate == false)
            {
                //检测新版本
                this.CheckNewVersion(btnNewVersion);
            });
                HdlThreadLogic.Current.RunThread(() =>
                {
                    //检测新版本
                    this.CheckNewVersion(btnNewVersion);
                });
            }
        }
        #endregion
@@ -245,6 +272,11 @@
        /// </summary>
        private void InitTopRightMenu()
        {
            //如果是展示模板的话,不能编辑
            if (Common.Config.Instance.Home.IsShowTemplate == true)
            {
                return;
            }
            var btnIcon = new MostRightIconControl(69, 69);
            btnIcon.UnSelectedImagePath = "Item/More.png";
            topFrameLayout.AddChidren(btnIcon);
@@ -326,15 +358,15 @@
        /// 检测新版本
        /// </summary>
        /// <param name="btnNewVersion">提示有新版本的控件</param>
        private async void CheckNewVersion(PicViewControl btnNewVersion)
        private void CheckNewVersion(PicViewControl btnNewVersion)
        {
            //获取网关版本信息
            var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway);
            var result = HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway, ShowErrorMode.NO);
            if (result == null)
            {
                return;
            }
            Application.RunOnMainThread(() =>
            HdlThreadLogic.Current.RunMain(() =>
            {
                if (this.Parent != null)
                {
@@ -344,7 +376,7 @@
                        btnNewVersion.Visible = true;
                    }
                }
            });
            }, ShowErrorMode.NO);
        }
        #endregion
@@ -355,10 +387,10 @@
        /// 设置网关名字
        /// </summary>
        /// <param name="gatewayName">网关名称</param>
        private async void SetGatewayName(string gatewayName, bool closeForm)
        private void SetGatewayName(string gatewayName, bool closeForm)
        {
            //修改网关名
            var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName);
            var result = HdlGatewayLogic.Current.ReName(zbGateway, gatewayName);
            //网关修改失败
            if (result == false)
            {
@@ -379,9 +411,9 @@
        /// </summary>
        /// <param name="gatewayId"></param>
        /// <param name="online"></param>
        private async void DoSwitchGateway()
        private void DoSwitchGateway()
        {
            var result = await HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId);
            var result = HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId);
            if (result == false)
            {
                return;
@@ -424,13 +456,13 @@
        /// <param name="row"></param>
        private void DeleteGateway(string strWayId)
        {
            HdlThreadLogic.Current.RunThread(async () =>
            HdlThreadLogic.Current.RunThread(() =>
            {
                //打开进度条
                this.ShowProgressBar();
                //删除云端网关
                bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId);
                bool result = HdlGatewayLogic.Current.DeleteGateway(strWayId);
                //关闭进度条
                this.CloseProgressBar();
                if (result == false)