wxr
2020-12-09 d60b92c58ac09197642eb6dac9b905f0898dacb8
HDL_ON/Common/HDLCommon.cs
@@ -245,20 +245,16 @@
        /// <param name="jpushMessageInfo"></param>
        public void AdjustPushMessage(JPushMessageInfo jpushMessageInfo)
        {
#if DEBUG
            return;
#endif
            try
            {
                if (jpushMessageInfo.Extras != null && jpushMessageInfo.Extras.Contains("OffLine"))
                {
                    Shared.Application.RunOnMainThread(() =>
                    {
                        //账号在别处登陆,被踢下线 跳转到登录页面
                        new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show();
                        //2020-12-04 待增加退出登录操作
                        Logout();
                        //退出登录操作
                        CheckLogout();
                    });
                    return;
                }
@@ -269,7 +265,6 @@
                        new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show();
                    });
                    return;
                }
            }
            catch
@@ -281,62 +276,65 @@
        /// <summary>
        /// 退出登录操作
        /// </summary>
        public void CheckLogout()
        {
#if DEBUG
            return;
#endif
            //未登录不用处理
            if (!UserInfo.Current.IsLogin) return;
            Logout();
        }
        /// <summary>
        /// 退出登录操作
        /// </summary>
        public void Logout()
        {
            return;
            try
            new System.Threading.Thread(() =>
            {
                //未登录不用处理
                if (!UserInfo.Current.IsLogin) return;
                Shared.Application.RunOnMainThread(() =>
                try
                {
                    #region 保存本地数据至文件夹
                    string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString());
                    new System.Threading.Thread(() =>
                    //清空之前的住宅文件
                    FileUtils.DeleteRegionFiles(oldRegionRootPath);
                    var backuplist = FileUtils.ReadFiles();
                    //移动文件
                    foreach (var fileName in backuplist)
                    {
                        try
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName);
                        if (fileInfo.Exists)
                        {
                            var backuplist = FileUtils.ReadFiles();
                            FileUtils.DeleteRegionFiles(oldRegionRootPath);
                            //移动文件
                            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);
                                }
                            }
                            fileInfo.MoveTo(oldRegionRootPath + fileName);
                            MainPage.Log("move file : " + fileName);
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"xxx:{ex.Message}");
                        }
                        finally
                        {
                            FileUtils.DeleteAllFile();
                        }
                    }).Start();
                    }
                    #endregion
                    ////2.注销推送
                }
                catch (Exception ex)
                {
                    MainPage.Log($"xxx:{ex.Message}");
                }
                finally
                {
                    FileUtils.DeleteAllFile();
                    //2.注销推送
                    new HttpServerRequest().SignOutPush();
                    //3.跳转登录页面
                    UserInfo.Current.LastTime = DateTime.MinValue;
                    UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//重置用户头像
                    UserInfo.Current.SaveUserInfo();
                    MainPage.GoLoginPage(UserInfo.Current);
                    DB_ResidenceData.residenceData.EixtAccount();
                });
            }
            catch (Exception ex)
            {
                MainPage.Log($"xxx:{ex.Message}");
            }
                    Shared.Application.RunOnMainThread(() =>
                    {
                        MainPage.GoLoginPage(UserInfo.Current);
                        DB_ResidenceData.residenceData.EixtAccount();
                    });
                }
            }).Start();
        }
        #endregion
    }