wei
2020-12-12 9ed4d6675aa1f0abe20e3f84e92f5ac2da8ab4f4
HDL_ON/UI/MainPage.cs
@@ -91,32 +91,36 @@
                BaseView = Application.MainPage;
                Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor;
                //LoginUser = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile("UserInfo_File")));
                //判断需不需要登录,有没有登录,或者登录是否过期,
                if (UserInfo.Current == null || !UserInfo.Current.IsLogin)
                if (string.IsNullOrEmpty(OnAppConfig.Instance.LastLoginUserId))
                {
                    GoLoginPage(UserInfo.Current);
                    GoLoginPage();
                }
                else
                {
                    new System.Threading.Thread(() =>
                    //判断需不需要登录,有没有登录,或者登录是否过期,
                    if (UserInfo.Current == null || !UserInfo.Current.IsLogin)
                    {
                        var pm = new DAL.Server.HttpServerRequest();
                        pm.RefreshToken();//刷新Token
                        GoLoginPage(UserInfo.Current);
                    }
                    else
                    {
                        new System.Threading.Thread(() =>
                        {
                            var pm = new DAL.Server.HttpServerRequest();
                            pm.RefreshToken();//刷新Token
                        pm.GetHomePager();//刷新住宅信息
                        pm.GetUserInfo();//刷新个人信息
                    })
                    { IsBackground = true }.Start();
                        { IsBackground = true }.Start();
                    GoUserPage();
                    //启动密码验证
                    new AppUnlockPage().LoadPage();
                        GoUserPage(true);
                    ///初始化app数据
                    InitializationData();
                        ///初始化app数据
                        InitializationData();
                    }
                }
            }
            catch (Exception ex)
            {
@@ -146,7 +150,8 @@
        /// <summary>
        /// 进入主页
        /// </summary>
        public static void GoUserPage()
        /// <param name="isFirstOpen">如果是第一次启动 检测校验密码</param>
        public static void GoUserPage(bool isFirstOpen = false)
        {
            //加载Loading效果
            var waitPage = new Loading();
@@ -207,13 +212,20 @@
                        };
                        BaseView.AddChidren(BasePageView);
                    //跳转页面----
                    var userPage = new UserPage();
                        //跳转页面----
                        var userPage = new UserPage();
                        BasePageView.AddChidren(userPage);
                        userPage.LoadPage();
                        BasePageView.PageIndex = 0;
                        if (isFirstOpen)
                        {
                            //启动密码验证
                            new AppUnlockPage().LoadPage(isFirstOpen);
                        }
                    });
                }catch(Exception ex)
                }
                catch (Exception ex)
                {
                    MainPage.Log($"GoUserPage : {ex.Message}");
                }
@@ -229,8 +241,7 @@
            {
                while (true)
                {
                    if (Entity.DB_ResidenceData.residenceData == null ||
                    Entity.DB_ResidenceData.residenceData.HomeGateway == null)
                    if (Entity.DB_ResidenceData.residenceData == null )//|| Entity.DB_ResidenceData.residenceData.HomeGateway == null)
                    {
                        System.Threading.Thread.Sleep(100);
                    }