黄学彪
2020-07-13 23420922845c9e77019a55c3b3e3271eb1ec261e
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlRoomLogic.cs
@@ -62,7 +62,7 @@
            //检测我的喜爱这个房间对象
            this.CheckLoveRoom();
            var listFile = Global.FileListByHomeId();
            var listFile = HdlFileLogic.Current.GetRootPathListFile();
            foreach (var fileName in listFile)
            {
                if (fileName.StartsWith("Room_") == true)
@@ -75,8 +75,6 @@
                    }
                }
            }
            //设置当前楼层的ID
            Config.Instance.Home.SetCurrentFloorId();
            //顺便刷新场景
            HdlSceneLogic.Current.ReFreshByLocal();
            //刷新房间视图列表
@@ -88,7 +86,7 @@
        /// </summary>
        public void RefreshAllRoomByLocation()
        {
            var listFile = Global.FileListByHomeId();
            var listFile = HdlFileLogic.Current.GetRootPathListFile();
            //我的喜爱的房间必须要在第0位才行
            string fRoom = "Room_Favorite.json";
@@ -242,6 +240,17 @@
        /// <returns></returns>
        public void RemoveRoom(string roomId, bool refreshLeftView = true)
        {
            if (this.NowMainPageRoom != null && this.NowMainPageRoom.Id == roomId)
            {
                //当删除的是主页的房间的时候
                this.NowMainPageRoom = this.GetLoveRoom();
            }
            if (this.NowCategoryRoom != null && this.NowCategoryRoom.Id == roomId)
            {
                //当删除的是分类的房间的时候
                this.NowCategoryRoom = this.GetLoveRoom();
            }
            //根据房间Id,获取房间对象
            var room = this.GetRoomById(roomId);
            if (room == null)
@@ -482,7 +491,7 @@
                    }
                }
            }
            return listRoom;
            return this.SortRoom(listRoom);
        }
        /// <summary>
@@ -497,35 +506,6 @@
                listRoom.Add(room);
            }
            return this.SortRoom(listRoom);
        }
        /// <summary>
        /// 获取当前楼层的房间名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<string> GetRoomNamesByFloorId(string id)
        {
            var listName = new List<string>();
            if (Config.Instance.Home.FloorDics.Count == 0)
            {
                //没有楼层
                foreach (var room in this.dicRooms.Values)
                {
                    listName.Add(room.Name);
                }
            }
            else
            {
                foreach (var room in this.dicRooms.Values)
                {
                    if (room.FloorId == id)
                    {
                        listName.Add(room.Name);
                    }
                }
            }
            return listName;
        }
        /// <summary>
@@ -557,17 +537,10 @@
                    }
                }
            }
            listRoom = this.SortRoom(listRoom);
            listRoom.Insert(0, GetLoveRoom());
            return listRoom;
        }
        /// <summary>
        /// 获取当前楼层的房间(拼接了【常用】在第一位)
        /// </summary>
        /// <returns></returns>
        public List<Room> GetRoomsByCurrentFloorIdAppendLoveRoom()
        {
            return this.GetRoomsByFloorIdAppendLoveRoom(Config.Instance.Home.CurrentFloorId);
        }
        #endregion
@@ -590,7 +563,7 @@
                //移除我的喜爱
                this.DeleteLoveDevice(device);
                //设备改变房间的话,主页需要重新刷新
                UserView.UserPage.Instance.RefreshForm = true;
                UserView.UserPage.Instance.RefreshAllForm = true;
                return;
            }
            //房间是否修改
@@ -608,7 +581,7 @@
                this.AddDevice(room, device, saveRealRoom);
            }
            //设备改变房间的话,主页需要重新刷新
            UserView.UserPage.Instance.RefreshForm = true;
            UserView.UserPage.Instance.RefreshAllForm = true;
        }
        /// <summary>
@@ -681,6 +654,8 @@
                    //保存到本地
                    loveRoom.ListDevice.Add(mainkeys);
                    loveRoom.Save();
                    //添加收藏设备时,需要刷新主页
                    UserView.UserPage.Instance.RefreshAllForm = true;
                }
            }
        }
@@ -744,6 +719,8 @@
                loveRoom.Save();
                //更改自动备份
                HdlAutoBackupLogic.AddOrEditorFile(loveRoom.FileName);
                //添加收藏设备时,需要刷新主页
                UserView.UserPage.Instance.RefreshAllForm = true;
            }
        }
@@ -1021,6 +998,11 @@
        /// <returns></returns>
        public Dictionary<string, string> GetFloorSortList()
        {
            //没有楼层
            if (Config.Instance.Home.FloorDics.Count == 0)
            {
                return new Dictionary<string, string>();
            }
            //从一堆文字中,获取这一堆文字里面数字字符串的最长长度
            var listName = new List<string>();
            foreach (var floorName in Config.Instance.Home.FloorDics.Values)