HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayProductInfoForm.cs
@@ -44,18 +44,48 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            var listBackControl = new VerticalFrameControl();
            listBackControl.Height = bodyFrameLayout.Height;
            bodyFrameLayout.AddChidren(listBackControl);
            bool gateWayExist = HdlGatewayLogic.Current.IsGatewayExist(zbGateway);
            var framePic = new FrameLayout();
            framePic.Width = Application.GetRealWidth(855);
            framePic.Height = Application.GetRealHeight(570);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.Y = Application.GetRealHeight(58);
            listBackControl.frameTable.AddChidren(framePic);
            var linuxImageType = this.zbGateway.LinuxImageType.ToString();
            var imageFile = "Gateway/RealGateway" + linuxImageType + ".png";
            imageFile = IO.FileUtils.GetImageFilePath(imageFile);
            if (imageFile == string.Empty)
            {
                //如果没有指定的网关的真实图片的话,则用共通图片
                imageFile = IO.FileUtils.GetImageFilePath("Gateway/RealGateway.png");
            }
#if Android
            //设备图片
            var bim = Android.Graphics.BitmapFactory.DecodeFile(imageFile);
            var btnpictrue = new PicViewControl(bim.Width, bim.Height);
#endif
#if iOS
            //设备图片
            var bim = UIKit.UIImage.FromFile(imageFile);
            var btnpictrue = new PicViewControl((int)bim.Size.Width, (int)bim.Size.Height);
#endif
            bim.Dispose();
            bim = null;
            //图片
            var btnImage = new PicViewControl(855, 570, true);
            btnImage.Y = Application.GetRealHeight(58);
            btnImage.Gravity = Gravity.CenterHorizontal;
            HdlGatewayLogic.Current.SetRealGatewayPictrue(btnImage, zbGateway);
            bodyFrameLayout.AddChidren(btnImage);
            btnpictrue.Gravity = Gravity.Center;
            btnpictrue.UnSelectedImagePath = imageFile;
            framePic.AddChidren(btnpictrue);
            //初始化桌布
            var tableContr = new InformationEditorControl();
            var listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 708, 1028);
            var listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uDeviceEditor), 1028);
            //设备备注(如果这个网关没有绑定的话,只允许查看,不能更改)
            string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
@@ -64,6 +94,7 @@
            if (gateWayExist == true)
            {
                btnGateName = new FrameCaptionInputControl(caption, deviceName, listview.rowSpace / 2);
                btnGateName.txtInput.MaxByte = 32;//限制只能输入32个字节
                listview.AddChidren(btnGateName);
                btnGateName.InitControl();
                //划线
@@ -92,32 +123,35 @@
                btnNote.AddBottomLine();
            }
            //设备类型
            //设备类型 (固定智能网关)
            caption = Language.StringByID(R.MyInternationalizationString.uDeviceType);
            var btnType = new FrameCaptionViewControl(caption, string.Empty, 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();
            //划线
            btnType.AddBottomLine();
            HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, zbGateway);
            //所属区域
            caption = Language.StringByID(R.MyInternationalizationString.uBelongArea);
            var btnBeloneArea = new FrameCaptionViewControl(caption, Common.Config.Instance.Home.Name, listview.rowSpace / 2);
            btnBeloneArea.UseClickStatu = false;
            listview.AddChidren(btnBeloneArea);
            btnBeloneArea.InitControl();
            //划线
            btnBeloneArea.AddBottomLine();
            //安装位置
            var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2);
            listview.AddChidren(rowBeloneArea);
            rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.zbGateway);
            //底线
            rowBeloneArea.AddBottomLine();
            rowBeloneArea.SelectRoomEvent += (roomKeys) =>
            {
                //变更网关房间
                HdlRoomLogic.Current.ChangedGatewayRoom(this.zbGateway.GwId, roomKeys);
            };
            //完成初始化桌布
            tableContr.FinishInitControl(bodyFrameLayout, listview);
            tableContr.FinishInitControl();
            if (gateWayExist == true)
            {
                //更多配置
                var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false);
                var btnHelp = new NormalViewControl(listBackControl.frameTable.Width, Application.GetRealHeight(49), false);
                btnHelp.Y = Application.GetRealHeight(1388);
                btnHelp.TextSize = 12;
                btnHelp.TextAlignment = TextAlignment.Center;
@@ -128,14 +162,14 @@
                    var form = new GatewayManage.GatewayInfoEditorForm();
                    this.AddFromAndRemoveNowForm(form, zbGateway);
                };
                bodyFrameLayout.AddChidren(btnHelp);
                listBackControl.frameTable.AddChidren(btnHelp);
                //底线
                int lineWidth = btnHelp.GetRealWidthByText(12);
                int lineWidth = btnHelp.GetRealWidthByText();
                var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
                btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
                btnLine.Gravity = Gravity.CenterHorizontal;
                btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8);
                bodyFrameLayout.AddChidren(btnLine);
                listBackControl.frameTable.AddChidren(btnLine);
            }
            //完成按钮
@@ -148,6 +182,7 @@
                {
                    //如果这个网关还没有绑定,则直接关闭界面
                    this.CloseForm();
                    return;
                }
                //完成按钮按下
                this.FinishButtonClick(btnGateName.Text);
@@ -187,12 +222,12 @@
        /// </summary>
        /// <param name="gatewayName">网关名称</param>
        /// <param name="closeForm">关闭界面</param>
        private async void SetGatewayName(string gatewayName, bool closeForm)
        private void SetGatewayName(string gatewayName, bool closeForm)
        {
            //打开进度条
            this.ShowProgressBar();
            //修改本地网关名
            var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName);
            var result = HdlGatewayLogic.Current.ReName(zbGateway, gatewayName);
            //关闭进度条
            this.CloseProgressBar();