| | |
| | | GoUserPage(); |
| | | //启动密码验证 |
| | | new AppUnlockPage().LoadPage(); |
| | | //读取音乐信息 |
| | | UI.Music.A31MusicModel.ReadMusicStates(); |
| | | //搜索网关 |
| | | |
| | | #if DEBUG |
| | | Entity.DB_ResidenceData.residenceData.residenceGatewayMAC = "4E47323347591243"; |
| | | Entity.DB_ResidenceData.residenceData.GatewayType = 0; |
| | | #endif |
| | | DriverLayer.Control.Ins.SearchLoaclGateway(); |
| | | ///初始化app数据 |
| | | InitializationData(); |
| | | } |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化app所需要的数据 |
| | | /// </summary> |
| | | public static void InitializationData() |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | if (Entity.DB_ResidenceData.residenceData == null || |
| | | Entity.DB_ResidenceData.residenceData.HomeGateway == null) |
| | | { |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | #region 读取云端数据-- |
| | | //todo数据覆盖处理 |
| | | //读取云端房间、楼层数据 |
| | | Entity.SpatialInfo.CurrentSpatial.DownloadRoomList(); |
| | | //读取云端设备数据 |
| | | Entity.FunctionList.List.DownloadFunctionList(); |
| | | //读取云端场景数据 |
| | | Entity.FunctionList.List.DownloadSceneList(); |
| | | #endregion |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | #region 读取本地数据 |
| | | //读取音乐信息 |
| | | UI.Music.A31MusicModel.ReadMusicStates(); |
| | | //搜索网关 |
| | | DriverLayer.Control.Ins.SearchLoaclGateway(); |
| | | #endregion |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自定义日志输出 |
| | | /// </summary> |
| | | public static void Log(string msg) |
| | |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成13位时间戳 |
| | | /// </summary> |
| | | /// <param name="value">时间</param> |
| | | /// <returns></returns> |
| | | public static long GetTimestamp13bit(DateTime value) |
| | | { |
| | | return new DateTimeOffset(value).ToUnixTimeSeconds(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取时间 |
| | | /// </summary> |
| | | /// <param name="timestamp"></param> |
| | | /// <returns></returns> |
| | | public static DateTime GetDateTime (long timestamp) |
| | | { |
| | | long begtime = timestamp * 10000000; |
| | | DateTime dt_1970 = new DateTime(1970, 1, 1, 0, 0, 0); |
| | | long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度 |
| | | long time_tricks = tricks_1970 + begtime;//日志日期刻度 |
| | | DateTime dt = new DateTime(time_tricks);//转化为DateTime |
| | | return dt; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |