| | |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.UI; |
| | | using HDL_ON.Entity; |
| | | using System.Threading; |
| | | |
| | | namespace HDL_ON |
| | | { |
| | |
| | | /// </summary> |
| | | public class HDLCommon |
| | | { |
| | | /// <summary> |
| | | /// 收到推送Action事件 |
| | | /// </summary> |
| | | public static Action GetPushMessageAction; |
| | | |
| | | #region ■ 变量声明___________________________ |
| | | /// <summary> |
| | | /// 通用方法 |
| | |
| | | // 1.1 没有更新 返回 |
| | | if (mUpdateDialogInfo.UpdateType == 0) return; |
| | | // 1.2 有新版本但是忽略过 返回 |
| | | if (mUpdateDialogInfo.UpdateType == 1 && (UserInfo.Current.IgnoreUpdateVersion == mUpdateDialogInfo.NewVersion)) return; |
| | | if (mUpdateDialogInfo.UpdateType == 1 && (OnAppConfig.Instance.IgnoreUpdateVersion == mUpdateDialogInfo.NewVersion)) return; |
| | | // 2.1 有新版本没有忽略过 提示更新 |
| | | if (mUpdateDialogInfo.UpdateType == 1) |
| | | { |
| | |
| | | |
| | | Action cancelAction = () => |
| | | { |
| | | UserInfo.Current.IgnoreUpdateVersion = mUpdateDialogInfo.NewVersion; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | OnAppConfig.Instance.IgnoreUpdateVersion = mUpdateDialogInfo.NewVersion; |
| | | OnAppConfig.Instance.SaveConfig(); |
| | | }; |
| | | |
| | | //1提示更新 |
| | |
| | | new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show(); |
| | | //退出登录操作 |
| | | CheckLogout(); |
| | | |
| | | }); |
| | | return; |
| | | } |
| | |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | GetPushMessageAction?.Invoke(); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | //未登录不用处理 |
| | | if (!UserInfo.Current.IsLogin) return; |
| | | |
| | | #if DEBUG |
| | | return; |
| | | #endif |
| | | |
| | | Logout(); |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public void Logout() |
| | | { |
| | | new System.Threading.Thread(() => |
| | | //加载Loading效果 |
| | | var waitPage = new Loading(); |
| | | MainPage.BasePageView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | #region 保存本地数据至文件夹 |
| | | //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); |
| | | ////清空之前的住宅文件 |
| | | //FileUtils.DeleteRegionFiles(oldRegionRootPath); |
| | | //var backuplist = FileUtils.ReadFiles(); |
| | | ////移动文件 |
| | | //foreach (var fileName in backuplist) |
| | | //{ |
| | | // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); |
| | | // if (fileInfo.Exists) |
| | | // { |
| | | // fileInfo.MoveTo(oldRegionRootPath + fileName); |
| | | // MainPage.Log("move file : " + fileName); |
| | | // } |
| | | //} |
| | | #endregion |
| | | //2.注销推送 |
| | | new HttpServerRequest().SignOutPush(); |
| | | //3.跳转登录页面 |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | DB_ResidenceData.Instance.EixtAccount(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | //FileUtils.DeleteAllFile(); |
| | | //2.注销推送 |
| | | new HttpServerRequest().SignOutPush(); |
| | | //3.跳转登录页面 |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//重置用户头像 |
| | | UserInfo.Current.SaveUserInfo(); |
| | | Shared.Application.RunOnMainThread(() => |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | MainPage.GoLoginPage(UserInfo.Current); |
| | | DB_ResidenceData.residenceData.EixtAccount(); |
| | | }); |
| | | } |
| | | }).Start(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 常用方法_______________________ |