| | |
| | | UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
|
| | |
|
| | | //初始化登陆账号的信息
|
| | | var hadNet = await InitUserAccoutInfo();
|
| | | var hadNet = await InitUserAccoutInfo(true);
|
| | | //如果有网络的话
|
| | | if (hadNet == true)
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 初始化登陆账号的信息
|
| | | /// </summary>
|
| | | /// <param name="reLoad">是否从新从本地加载(重新初始化登陆账号的信息,不需要重新加载)</param>
|
| | | /// <returns></returns>
|
| | | private async static Task<bool> InitUserAccoutInfo()
|
| | | private async static Task<bool> InitUserAccoutInfo(bool reLoad)
|
| | | {
|
| | | //初始化个人信息的标识
|
| | | UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | | if (reLoad == true)
|
| | | {
|
| | | //获取本地记录的用户信息
|
| | | UserCenterResourse.UserInfo = GetUserInformationFromLocation();
|
| | | UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
|
| | | }
|
| | |
|
| | | //获取登录账号的信息
|
| | | var pra = new AccountInfoPra();
|
| | |
| | | private async static Task<bool> ReInitUserAccoutInfo()
|
| | | {
|
| | | //重新初始化账号信息
|
| | | var result = await InitUserAccoutInfo();
|
| | | var result = await InitUserAccoutInfo(false);
|
| | | if (result == false)
|
| | | {
|
| | | return result;
|
| | |
| | | /// <param name="obj">需要序列化的东西</param>
|
| | | public static void SaveFileContent(string fullName, object obj)
|
| | | {
|
| | | var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(data);
|
| | | var data = JsonConvert.SerializeObject(obj);
|
| | | var byteData = Encoding.UTF8.GetBytes(data);
|
| | | //写入内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
|
| | | System.IO.FileStream fileStream = null;
|
| | | try
|
| | | {
|
| | | fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
|
| | | fileStream.Write(byteData, 0, byteData.Length);
|
| | | fileStream.Flush();
|
| | | }
|
| | | catch { }
|
| | | finally
|
| | | {
|
| | | fileStream?.Close();
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|