| | |
| | | MainPage.Log($"进入读取云端数据线程"); |
| | | //===================刷新Token======================= |
| | | code = Ins.HttpRequest.RefreshToken(); |
| | | if (code != StateCode.SUCCESS) |
| | | { |
| | | DownloadDataComplete = true; |
| | | hadInternet = false; |
| | | try |
| | | { |
| | | var spatialInfoDataBytes = FileUtlis.Files.ReadFile("SpatialInfoData"); |
| | | if (spatialInfoDataBytes != null) |
| | | { |
| | | var spatialInfoDataString = System.Text.Encoding.UTF8.GetString(spatialInfoDataBytes); |
| | | if (spatialInfoDataString != null && !string.IsNullOrEmpty(spatialInfoDataString)) |
| | | { |
| | | var spatialInfoDataList = JsonConvert.DeserializeObject<List<SpatialInfo>>(spatialInfoDataString); |
| | | SpatialInfo.CurrentSpatial.UpdateSpatialList(spatialInfoDataList); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("Error", $"{this.GetType()}:加载缓存房间数据异常:{ex.StackTrace}"); |
| | | } |
| | | |
| | | try |
| | | { |
| | | var fileList = Common.FileUtlis.Files.ReadFiles(); |
| | | foreach (var file in fileList) |
| | | { |
| | | FunctionList.List.IniFunctionList(file, true); |
| | | } |
| | | Room.CurrentSpatial.InitRoomListFunctions(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("Error", $"{this.GetType()}:加载缓存设备数据异常:{ex.StackTrace}"); |
| | | } |
| | | MainPage.Log($"刷新token失败"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | hadInternet = true; |
| | | } |
| | | if (code != StateCode.SUCCESS) |
| | | { |
| | | if (waitPage != null) |
| | |
| | | catch { } |
| | | }); |
| | | } |
| | | MainPage.Log($"刷新token失败"); |
| | | return; |
| | | } |
| | | MainPage.Log($"刷新token成功"); |