| | |
| | | /// </summary> |
| | | public string ResidenceAddressName = string.Empty; |
| | | /// <summary> |
| | | /// 房间列表(房间的ID) |
| | | /// </summary> |
| | | public List<string> ListRooms = new List<string>(); |
| | | /// <summary> |
| | | /// 楼层字典 |
| | | /// key:FloorId |
| | | /// value:FloorName |
| | | /// </summary> |
| | | public Dictionary<string,string> FloorDics = new Dictionary<string,string> { }; |
| | | /// <summary> |
| | | /// 当前楼层Id |
| | | /// </summary> |
| | | public string CurrentFloorId = string.Empty; |
| | | |
| | | #endregion |
| | | |
| | |
| | | public string GetCurrentFloorName |
| | | { |
| | | get |
| | | { |
| | | {
|
| | | return HdlResidenceLogic.Current.GetFloorNameById(CurrentFloorId); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前楼层的ID |
| | | }
|
| | | /// <summary>
|
| | | /// 当前楼层ID
|
| | | /// </summary> |
| | | public void SetCurrentFloorId() |
| | | { |
| | | if (Config.Instance.Home.FloorDics.Count > 0 && string.IsNullOrEmpty(CurrentFloorId)) |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | CurrentFloorId = floor.Key; |
| | | Save(false); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 添加房间路径_________________________ |
| | | |
| | | /// <summary> |
| | | /// 添加房间ID |
| | | /// </summary> |
| | | /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> |
| | | /// <param name="roomFilePath">Room file path.</param> |
| | | public void AddRoomId(string roomId) |
| | | { |
| | | if (ListRooms.Contains(roomId) == false) |
| | | {
|
| | | ListRooms.Add(roomId);
|
| | | this.Save(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 删除房间路径_________________________ |
| | | |
| | | /// <summary> |
| | | /// 移除房间Id |
| | | /// </summary> |
| | | /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> |
| | | /// <param name="roomFilePath">Room file path.</param> |
| | | public void RemoveRoomId(string roomId) |
| | | { |
| | | if (ListRooms.Contains(roomId)==true) |
| | | {
|
| | | ListRooms.Remove(roomId);
|
| | | Save(); |
| | | } |
| | | } |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public string CurrentFloorId = string.Empty; |
| | | |
| | | #endregion |
| | | |
| | |
| | | System.IO.Directory.CreateDirectory(path); |
| | | } |
| | | path = System.IO.Path.Combine(path, FileName); |
| | | Shared.IO.FileUtils.WriteFileByBytes(path, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); |
| | | HdlFileLogic.Current.SaveFileContent(path, this); |
| | | |
| | | if (autoBackup == true && Id == Config.Instance.HomeId) |
| | | { |
| | | HdlAutoBackupLogic.AddOrEditorFile(FileName); |