| | |
| | | using System; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Threading; |
| | |
| | | |
| | | namespace HDL_ON.Entity |
| | | { |
| | | [System.Serializable] |
| | | public class DB_ResidenceData |
| | | { |
| | | public DB_ResidenceData() |
| | |
| | | /// </summary> |
| | | public string MasterToken; |
| | | |
| | | RegionInfoRes _residecenInfo; |
| | | //RegionInfoRes _residecenInfo; |
| | | RegionInfoRes _residecenInfo = new RegionInfoRes(); |
| | | /// <summary> |
| | | /// 住宅基础信息 |
| | | /// </summary> |
| | |
| | | { |
| | | if (MainPage.NoLoginMode) |
| | | { |
| | | return new RegionInfoRes() { Name = "本地模式" }; |
| | | return new RegionInfoRes() { homeName = "HDL Home" ,id = "text000001"}; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 获取网关列表 |
| | | ///// </summary> |
| | | //void GetHomeGatewayList() |
| | | //{ |
| | | // new Thread(() => |
| | | // { |
| | | // //切换住宅后,查询一次网关列表 |
| | | // new HttpServerRequest().GetHomeGatewayList(); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | |
| | | //} |
| | | |
| | | //string curReginID; |
| | | ///// <summary> |
| | | ///// 当前选择的住宅索引 |
| | | ///// </summary> |
| | | //public string CurReginID |
| | | //{ |
| | | // set |
| | | // { |
| | | // curReginID = value; |
| | | // GetHomeGatewayList(); |
| | | // } |
| | | // get |
| | | // { |
| | | // return curReginID; |
| | | // } |
| | | //} |
| | | /// <summary> |
| | | /// 功能类型列表 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public List<ShowFunction> functionTypeList = new List<ShowFunction>(); |
| | | |
| | | static DB_ResidenceData instance; |
| | |
| | | { |
| | | if (instance == null) |
| | | { |
| | | if(MainPage.NoLoginMode) |
| | | { |
| | | instance = new DB_ResidenceData(); |
| | | instance.functionTypeList.AddRange(new List<ShowFunction> { |
| | | ShowFunction.Light,ShowFunction.AC,ShowFunction.Curtain, |
| | | ShowFunction.FloorHeating,ShowFunction.Music, |
| | | ShowFunction.Electric,ShowFunction.Environmental, |
| | | ShowFunction.EnergyMonitoring, |
| | | ShowFunction.FreshAir,ShowFunction.DoorLock, |
| | | ShowFunction.Panel,ShowFunction.SecurityMonitoring, |
| | | ShowFunction.Sensor,ShowFunction.VideoIntercom, |
| | | ShowFunction.SecurityCenter |
| | | }); |
| | | instance.SaveResidenceData(); |
| | | instance.residenceImage = "Classification/Room/Roombg.png"; |
| | | instance.HomeGateway = new HomeGatewayInfo() |
| | | { |
| | | homeId = "1396717478877241345", |
| | | gatewayId = "1396997079658602498", |
| | | mac = "123457890123456", |
| | | }; |
| | | //初始化住宅功能数据 |
| | | SpatialInfo.CurrentSpatial.InitRoomListFunctions(); |
| | | return instance; |
| | | } |
| | | |
| | | try |
| | | { |
| | | var residenceDataBytes = ReadResidenceInfo(); |
| | |
| | | { |
| | | instance = temp; |
| | | } |
| | | if (instance.functionTypeList.Count == 0) |
| | | { |
| | | instance.functionTypeList.AddRange(new List<ShowFunction> { |
| | | instance.functionTypeList.AddRange(new List<ShowFunction> { |
| | | ShowFunction.Light,ShowFunction.AC,ShowFunction.Curtain, |
| | | ShowFunction.FloorHeating,ShowFunction.Music, |
| | | ShowFunction.Electric,ShowFunction.Environmental, |
| | | //ShowFunction.EnergyMonitoring, |
| | | //ShowFunction.FreshAir,ShowFunction.DoorLock, |
| | | //ShowFunction.Panel,ShowFunction.SecurityMonitoring, |
| | | //ShowFunction.Sensor,ShowFunction.VideoIntercom |
| | | ShowFunction.EnergyMonitoring, |
| | | ShowFunction.FreshAir,ShowFunction.DoorLock, |
| | | ShowFunction.Panel,ShowFunction.SecurityMonitoring, |
| | | ShowFunction.Sensor,ShowFunction.VideoIntercom, |
| | | ShowFunction.SecurityCenter |
| | | }); |
| | | instance.SaveResidenceData(); |
| | | } |
| | | instance.SaveResidenceData(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | instance.residenceImage = "Classification/Room/Roombg.png"; |
| | | //初始化住宅功能数据 |
| | | SpatialInfo.CurrentSpatial.InitRoomFunction(); |
| | | SpatialInfo.CurrentSpatial.InitRoomListFunctions(); |
| | | |
| | | } |
| | | return instance; |
| | |
| | | instance = null; |
| | | ins_OidList = null; |
| | | HomeGateway = null; |
| | | //重置网关状态 |
| | | DriverLayer.Control.Ins.GatewayOnline_Cloud = false; |
| | | DriverLayer.Control.Ins.GatewayOnline_Local = false; |
| | | SpatialInfo.CurrentSpatial.Clear(); |
| | | FunctionList.List.Clear(); |
| | | if (MainPage.IsRemote) |
| | | { |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("退出登录,或者切换住宅"); |
| | | } |
| | | |
| | | ///切换住宅清空前住宅缓存自动化列表; |
| | | HDL_ON.UI.UI2.Intelligence.Automation.Logic.LogicList.Clear(); |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("退出登录,或者切换住宅"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 记录窗帘全开全关状态 |
| | | /// </summary> |
| | | public bool GlobalCurtainStatus = false; |
| | | /// <summary> |
| | | /// 检测住宅是否绑定了网关 |
| | | /// gatewayId 判空 |
| | |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | WirteResidenceInfo(ssd); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 当前选择的楼层 |
| | | /// </summary> |
| | | public string CurFoor = Language.StringByID(StringId.All); |
| | | |
| | | /// <summary> |
| | | /// 当前选择的楼层 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public SpatialInfo CurFloor = new SpatialInfo() { roomId = "", roomName = Language.StringByID(StringId.All)}; |
| | | /// <summary> |
| | | /// 分类界面显示的楼层 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public SpatialInfo ClassificationChooseFloor = new SpatialInfo() { roomId = "", roomName = Language.StringByID(StringId.All) }; |
| | | |
| | | /// <summary> |
| | | /// 根目录 |
| | |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |