HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-12-30 3dcbd186c42c598c0c08d1cd37034cf2baa09e54
ZigbeeApp/Shared/Common/Room.cs
@@ -336,6 +336,19 @@
                }
            }
            Config.Instance.Home.InitFloor();
            RefreshRoomListView();
        }
        /// <summary>
        /// 刷新房间视图列表
        /// </summary>
        public static void RefreshRoomListView()
        {
            Application.RunOnMainThread(() =>
            {
                Phone.Device.Room.RoomManagement.Instance.Show();
            });
        }
        /// <summary>
@@ -445,8 +458,33 @@
            //删除来自拍照或者系统图库的房间背景图片
            if (room.BackgroundImageType == 1 || room.BackgroundImageType == 2)
            {
                DeleteBackGroundIamageFilebyHomeId(room.BackgroundImage);
                //删除掉原来的自定义图片
                if (Global.IsExistsByHomeId(room.BackgroundImage) == true)
                {
                    Global.DeleteFilebyHomeId(room.BackgroundImage);
                    //删除备份
                    HdlAutoBackupLogic.DeleteFile(room.BackgroundImage);
                }
            }
            //我的喜爱
            var loveRoom = this.GetLoveRoom();
            if (loveRoom != null)
            {
                //移除我的喜爱里面的设备
                for (int i = 0; i < room.DeviceUIFilePathList.Count; i++)
                {
                    loveRoom.DeviceUIFilePathList.Remove(room.DeviceUIFilePathList[i]);
                    loveRoom.DeviceUIList.RemoveAll((obj) => { return room.DeviceUIFilePathList[i] == obj.FileName; });
                }
                //移除我的喜爱里面的场景
                for (int i = 0; i < room.SceneUIFilePathList.Count; i++)
                {
                    loveRoom.SceneUIFilePathList.Remove(room.SceneUIFilePathList[i]);
                    loveRoom.SceneUIList.RemoveAll((obj) => { return room.SceneUIFilePathList[i] == obj.FileName; });
                }
                loveRoom.Save(false);
            }
            if (Global.IsExistsByHomeId(roomFilePath) == false)
            {
                return false;
@@ -770,31 +808,6 @@
        #endregion
        #region ◆ 房间背景图的相关___________________
        /// <summary>
        /// 删除背景图片
        /// </summary>
        /// <param name="fileName">fileName实际上包含了住宅路劲 如 住宅/文件名.</param>
        public static void DeleteBackGroundIamageFilebyHomeId(string fileName)
        {
            if (fileName == null)
            {
                return;
            }
            var pathLists = fileName.Split('/');
            if (pathLists == null || pathLists.Count() < 9 || pathLists[8] == null)
            {
                return;
            }
            var path = System.IO.Path.Combine(Config.Instance.FullPath, fileName);
            if (!Global.IsExistsByHomeId(pathLists[8]))
            {
                return;
            }
            //删除本地图片
            System.IO.File.Delete(path);
            //删除备份
            Phone.UserCenter.HdlAutoBackupLogic.DeleteFile(pathLists[8]);
        }
        /// <summary>
        /// 移动背景图片到住宅目录下