| | |
| | | //检测我的喜爱这个房间对象
|
| | | this.CheckLoveRoom();
|
| | |
|
| | | var listFile = Global.FileListByHomeId();
|
| | | var listFile = HdlFileLogic.Current.GetRootPathListFile();
|
| | | foreach (var fileName in listFile)
|
| | | {
|
| | | if (fileName.StartsWith("Room_") == true)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | //设置当前楼层的ID
|
| | | Config.Instance.Home.SetCurrentFloorId();
|
| | | //顺便刷新场景
|
| | | HdlSceneLogic.Current.ReFreshByLocal();
|
| | | //刷新房间视图列表
|
| | |
| | | /// </summary>
|
| | | public void RefreshAllRoomByLocation()
|
| | | {
|
| | | var listFile = Global.FileListByHomeId();
|
| | | var listFile = HdlFileLogic.Current.GetRootPathListFile();
|
| | |
|
| | | //我的喜爱的房间必须要在第0位才行
|
| | | string fRoom = "Room_Favorite.json";
|
| | |
| | | /// <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)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | return listRoom;
|
| | | return this.SortRoom(listRoom);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | 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>
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | 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
|
| | |
| | | //移除我的喜爱
|
| | | this.DeleteLoveDevice(device);
|
| | | //设备改变房间的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | return;
|
| | | }
|
| | | //房间是否修改
|
| | |
| | | this.AddDevice(room, device, saveRealRoom);
|
| | | }
|
| | | //设备改变房间的话,主页需要重新刷新
|
| | | UserView.UserPage.Instance.RefreshForm = true;
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | //保存到本地
|
| | | loveRoom.ListDevice.Add(mainkeys);
|
| | | loveRoom.Save();
|
| | | //添加收藏设备时,需要刷新主页
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | loveRoom.Save();
|
| | | //更改自动备份
|
| | | HdlAutoBackupLogic.AddOrEditorFile(loveRoom.FileName);
|
| | | //添加收藏设备时,需要刷新主页
|
| | | UserView.UserPage.Instance.RefreshAllForm = true;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /// <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)
|