HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-12-02 4c40f503acf2bcf90d294cc439ef46ba259b9c60
ZigbeeApp/Shared/Phone/UserCenter/Residence/EditorRoomInforForm.cs
@@ -59,23 +59,33 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            //房间图片
            var framePic = new FrameLayout();
            framePic.Y = Application.GetRealHeight(60);
            framePic.Width = Application.GetMinRealAverage(887);
            framePic.Height = Application.GetMinRealAverage(444);
            framePic.Gravity = Gravity.CenterHorizontal;
            framePic.Radius = 8;
            framePic.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
            bodyFrameLayout.AddChidren(framePic);
            var btnPic = new ImageView();
            btnPic.Y = Application.GetRealHeight(60);
            btnPic.Width = Application.GetMinRealAverage(887);
            btnPic.Height = Application.GetMinRealAverage(444);
            btnPic.Gravity = Gravity.CenterHorizontal;
            btnPic.Radius = 8;
            btnPic.ImagePath = this.editorRoom.BackgroundImage;
            bodyFrameLayout.AddChidren(btnPic);
            framePic.AddChidren(btnPic);
            if (this.editorRoom.BackgroundImageType == 0)
            {
                btnPic.ImagePath = this.editorRoom.BackgroundImage;
            }
            else
            {
                btnPic.ImageBytes = Common.Global.ReadFileByHomeId(this.editorRoom.BackgroundImage);
            }
            btnPic.MouseUpEventHandler += (sender, e) =>
            {
                //房间图片选择
                this.RoomPictrueSelect(btnPic);
            };
            //添加阴影特效
            var btnTemp = new ButtonBase();
            btnTemp.AddBottomShadow(btnPic, true);
            btnTemp = null;
            framePic.SetViewShadow(true);
            //初始化桌布
            var tableContr = new InformationEditorControl();
@@ -181,13 +191,12 @@
                    if (editorRoom.BackgroundImageType == 1 || editorRoom.BackgroundImageType == 2)
                    {
                        //删除掉原来的自定义图片
                        if (System.IO.File.Exists(editorRoom.BackgroundImage) == true)
                        if (Common.Global.IsExistsByHomeId(editorRoom.BackgroundImage) == true)
                        {
                            System.IO.File.Delete(editorRoom.BackgroundImage);
                            Common.Global.DeleteFilebyHomeId(editorRoom.BackgroundImage);
                        }
                        //备份
                        string[] MyArry = editorRoom.BackgroundImage.Split(new string[] { "/", @"\" }, StringSplitOptions.RemoveEmptyEntries);
                        HdlAutoBackupLogic.DeleteFile(MyArry[MyArry.Length - 1]);
                        HdlAutoBackupLogic.DeleteFile(editorRoom.BackgroundImage);
                    }
                    //自定义图片
                    if (cloneRoom.BackgroundImageType == 1 || cloneRoom.BackgroundImageType == 2)
@@ -196,7 +205,7 @@
                        string picName = $"RoomIcon_{DateTime.Now.ToString("yyyyMMddHHmmss")}.png";
                        string picFullName = System.IO.Path.Combine(Common.Config.Instance.FullPath, picName);
                        Shared.IO.FileUtils.WriteFileByBytes(picFullName, btnPic.ImageBytes);
                        cloneRoom.BackgroundImage = picFullName;
                        cloneRoom.BackgroundImage = picName;
                        //备份
                        HdlAutoBackupLogic.AddOrEditorFile(picName);
                    }