| | |
| | | /// <summary> |
| | | /// 仅子账号登陆的时候使用,当【IsOthreShare】为"true",并且【AccountType】为"1"时,该账号拥有管理员权限 |
| | | /// </summary> |
| | | public int AccountType; |
| | | public int AccountType;
|
| | | /// <summary>
|
| | | /// 经度
|
| | | /// </summary>
|
| | | public double Longitude = 0;
|
| | | /// <summary>
|
| | | /// 纬度
|
| | | /// </summary>
|
| | | public double Latitude = 0; |
| | | /// <summary>
|
| | | /// 住宅所在的地理位置的名称
|
| | | /// </summary> |
| | | public string ResidenceAddressName = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 房间路径列表 |
| | | /// 房间列表(房间的ID) |
| | | /// </summary> |
| | | public List<string> RoomFilePathList = new List<string> { }; |
| | | public List<string> ListRooms = new List<string>(); |
| | | |
| | | /// <summary> |
| | | /// 楼层字典 |
| | |
| | | /// </summary> |
| | | public Dictionary<string,string> FloorDics = new Dictionary<string,string> { }; |
| | | /// <summary> |
| | | /// 当前楼层 |
| | | /// 当前楼层Id |
| | | /// </summary> |
| | | public string CurrentFloorId; |
| | | public string CurrentFloorId = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 全局场景路径列表---备用 |
| | |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task<List<string>> GetHomeLists() |
| | | { |
| | | //清空当前住宅列表 |
| | | Config.Instance.HomeFilePathList.Clear(); |
| | | var pageSetting = new SendDataToServer.ResidenceListPageSettingObj() |
| | | { |
| | | PageSize = CommonPage.PageSize |
| | |
| | | if (responseDataObj.TotalCount == 0) |
| | | { |
| | | //当住宅为空时先提示用户新建住宅 |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.OK)); |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | alert.Show(); |
| | | alert.ResultEventHandler += (sender, e) => |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (Config.Instance.HomeId == string.Empty && responseDataObj.PageData.Count > 0) |
| | | { |
| | | //赋一个初始值 |
| | | Config.Instance.HomeId = responseDataObj.PageData[0].Id; |
| | | } |
| | | //清空当前住宅列表 |
| | | Config.Instance.HomeFilePathList.Clear(); |
| | | var listHouse = new List<House>(); |
| | | foreach (var residence in responseDataObj.PageData) |
| | | { |
| | | Config.Instance.HomeFilePathList.Add($"House_{residence.Id}.json"); |
| | |
| | | Name = residence.Name, |
| | | IsOthreShare = residence.IsOthreShare, |
| | | AccountType = residence.AccountType, |
| | | MainUserDistributedMark = residence.MainUserDistributedMark |
| | | MainUserDistributedMark = residence.MainUserDistributedMark, |
| | | Longitude = residence.Longitude, |
| | | Latitude = residence.Latitude |
| | | }; |
| | | } |
| | | else |
| | |
| | | house.Name = residence.Name; |
| | | house.IsOthreShare = residence.IsOthreShare; |
| | | house.AccountType = residence.AccountType; |
| | | house.MainUserDistributedMark = residence.MainUserDistributedMark; |
| | | house.MainUserDistributedMark = residence.MainUserDistributedMark;
|
| | | house.Longitude = residence.Longitude;
|
| | | house.Latitude = residence.Latitude; |
| | | } |
| | | Global.CreateHomeDirectory(residence.Id); |
| | | house.Save(); |
| | | house.Save(false); |
| | | listHouse.Add(house); |
| | | } |
| | | //匹配当前住宅 |
| | | if (Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) |
| | | //如果切换了账号,或者原来的id不存在,则重置住宅ID |
| | | if (UserCenterResourse.ResidenceOption.TheSameLoginAccount == false || |
| | | Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) |
| | | { |
| | | Config.Instance.HomeId = GetHouseIdByFilePath(Config.Instance.HomeFilePathList[0]); |
| | | Config.Instance.HomeId = listHouse[0].Id; |
| | | foreach (var house in listHouse)
|
| | | {
|
| | | //初始选择它自己的住宅
|
| | | if (house.IsOthreShare == false)
|
| | | {
|
| | | Config.Instance.HomeId = house.Id;
|
| | | Config.Instance.Home = House.GetHouseByHouseId(house.Id);
|
| | | break;
|
| | | }
|
| | | } |
| | | } |
| | | Config.Instance.Save(); |
| | | //检测住宅对象 |
| | | if (Config.Instance.Home.Id == string.Empty)
|
| | | {
|
| | | Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.HomeId);
|
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | if (Config.Instance.Home.FloorDics.Count == 0) |
| | | { |
| | | return null; |
| | | return string.Empty; |
| | | } |
| | | |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | |
| | | { |
| | | return floor.Value; |
| | | } |
| | | }
|
| | | return string.Empty; |
| | | } |
| | | |
| | | /// <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; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | #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 bool AddRoomListFilePath(string roomFilePath) |
| | | public void AddRoomId(string roomId) |
| | | { |
| | | if (RoomFilePathList.Contains(roomFilePath)) |
| | | { |
| | | return false; |
| | | if (ListRooms.Contains(roomId) == false) |
| | | {
|
| | | ListRooms.Add(roomId);
|
| | | this.Save(); |
| | | } |
| | | RoomFilePathList.Add(roomFilePath); |
| | | Save(); |
| | | return true; |
| | | } |
| | | |
| | | #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 bool RemoveRoomListFilePath(string roomFilePath) |
| | | public void RemoveRoomId(string roomId) |
| | | { |
| | | if (!RoomFilePathList.Contains(roomFilePath)) |
| | | { |
| | | return false; |
| | | if (ListRooms.Contains(roomId)==true) |
| | | {
|
| | | ListRooms.Remove(roomId);
|
| | | Save(); |
| | | } |
| | | RoomFilePathList.Remove(roomFilePath); |
| | | Save(); |
| | | return true; |
| | | } |
| | | |
| | | #endregion |