| | |
| | | { |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | return new RegionInfoRes() { Name = "本地模式" }; |
| | | return new RegionInfoRes() { Name = "本地模式" , }; |
| | | } |
| | | else |
| | | { |
| | |
| | | if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0) |
| | | { |
| | | UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; |
| | | //恢复备份 |
| | | //HDLCommon.Current.RestoreHomeBackup(CurReginID); |
| | | |
| | | return UserInfo.Current.regionList[0]; |
| | | } |
| | | else |
| | |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"住宅数据初始化失败:{ex.Message}"); |
| | | instance = new DB_ResidenceData { }; |
| | | return instance; |
| | | } |
| | | instance.residenceImage = "Classification/Room/Roombg.png"; |
| | | //初始化住宅功能数据 |
| | |
| | | public void EixtAccount() |
| | | { |
| | | instance = null; |
| | | Rooms = null; |
| | | ins_OidList = null; |
| | | functionList = null; |
| | | HomeGateway = null; |
| | | SpatialInfo.CurrentSpatial.ClearRooms(); |
| | | FunctionList.List.Clear(); |
| | | if (MainPage.IsRemote) |
| | | { |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("退出登录,或者切换住宅"); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测住宅是否绑定了网关 |
| | | /// gatewayId 判空 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public bool CheckWhetherGatewayIdIsNull() |
| | | { |
| | | if (HomeGateway != null && !string.IsNullOrEmpty(HomeGateway.gatewayId)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测住宅是否绑定了网关 |
| | | /// </summary> |
| | |
| | | return; |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes("DB_ResidenceData", ssd); |
| | | MainPage.Log("Save DB_ResidenceData"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public string CurFoor = Language.StringByID(StringId.All); |
| | | |
| | | /// <summary> |
| | | /// 房间列表 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public List<Room> Rooms = SpatialInfo.CurrentSpatial.RoomList; |
| | | |
| | | #region 功能数据 |
| | | static FunctionList _functionList; |
| | | public static FunctionList functionList |
| | | { |
| | | get |
| | | { |
| | | if (_functionList == null) |
| | | { |
| | | _functionList = FunctionList.List; |
| | | } |
| | | return _functionList; |
| | | } |
| | | set |
| | | { |
| | | _functionList = value; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | ///// <summary> |
| | | ///// 房间列表 |
| | | ///// </summary> |
| | | //[Newtonsoft.Json.JsonIgnore] |
| | | //public List<Room> Rooms = SpatialInfo.CurrentSpatial.RoomList; |
| | | |
| | | #region oid列表 a协议转bus协议控制使用 |
| | | /// <summary> |