wei
2020-12-25 f534d41c36d5895322bf691784a10435b64609fe
HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
        /// <summary>
        /// 版本号
        /// </summary>
        public static string VersionString = "1.0.1220";
        public static string VersionString = "1.0.1225";
        ///// <summary>
        ///// 客户端类型
        ///// </summary>
@@ -109,16 +109,17 @@
                    }
                    else
                    {
                        new System.Threading.Thread(() =>
                        {
                            var pm = new DAL.Server.HttpServerRequest();
                            pm.RefreshToken();//刷新Token
                            pm.GetHomePager();//刷新住宅信息
                            pm.GetUserInfo();//刷新个人信息
                        })
                        { IsBackground = true }.Start();
                        //new System.Threading.Thread(() =>
                        //{
                        //    var pm = new DAL.Server.HttpServerRequest();
                        //    pm.RefreshToken();//刷新Token
                        //    pm.GetHomePager();//刷新住宅信息
                        //    pm.GetUserInfo();//刷新个人信息
                        //})
                        //{ IsBackground = true }.Start();
                        Common.ApiUtlis.Ins.DownloadData();
                        GoUserPage(true);
                        GoUserPage(false,true);
                    }
                }
            }
@@ -152,7 +153,7 @@
        /// </summary>
        /// <param name="isFirstOpen">如果是第一次启动 检测校验密码</param>
        /// <param name="pageShowEvent">主页显示之后触发的事件(没有住宅的话,则不会触发)</param>
        public static void GoUserPage(bool isFirstOpen = false, Action pageShowEvent = null)
        public static void GoUserPage(bool downloadData , bool isFirstOpen = false, Action pageShowEvent = null)
        {
            //加载Loading效果
            var waitPage = new Loading();
@@ -226,8 +227,14 @@
                    MainPage.Log($"GoUserPage : {ex.Message}");
                }finally
                {
                    ///初始化app数据
                    InitializationData();
                    Application.RunOnMainThread(() =>
                    {
                        if (downloadData)
                        {
                            ///初始化app数据
                            Common.ApiUtlis.Ins.DownloadData();
                        };
                    });
                }
            }).Start();
        }
@@ -235,43 +242,43 @@
        /// <summary>
        /// 初始化app所需要的数据
        /// </summary>
        public static void InitializationData()
        public static void InitializationData1()
        {
            new System.Threading.Thread(() =>
            {
                while (true)
                {
                    if (Entity.DB_ResidenceData.Instance == null )//|| Entity.DB_ResidenceData.residenceData.HomeGateway == null)
                    {
                        System.Threading.Thread.Sleep(100);
                    }
                    else
                    {
                        break;
                    }
                }
                //System.Threading.Thread.Sleep(2000);
                #region 读取云端数据--
                //todo数据覆盖处理
                //读取云端房间、楼层数据
                Entity.SpatialInfo.CurrentSpatial.DownloadRoomList();
                //读取云端设备数据
                Entity.FunctionList.List.DownloadFunctionList();
                //读取云端场景数据
                Entity.FunctionList.List.DownloadSceneList();
                //读取逻辑列表
                UI.UI2.Intelligence.Automation.MainView.GetLogicList();
                #endregion
            //new System.Threading.Thread(() =>
            //{
            //    int count = 0;
            //    while (count< 10)
            //    {
            //        if (Entity.DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull() )//|| Entity.DB_ResidenceData.residenceData.HomeGateway == null)
            //        {
            //            System.Threading.Thread.Sleep(200);
            //        }
            //        else
            //        {
            //            break;
            //        }
            //        count++;
            //    }
            //    if(Entity.DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
            //    {
            //        return;
            //    }
            //    //System.Threading.Thread.Sleep(2000);
            //    #region 读取云端数据--
            //    //todo数据覆盖处理
            //    //读取云端房间、楼层数据
            //    Entity.SpatialInfo.CurrentSpatial.DownloadRoomList();
            //    //读取云端设备数据
            //    Entity.FunctionList.List.DownloadFunctionList();
            //    //读取云端场景数据
            //    Entity.FunctionList.List.DownloadSceneList();
            //    //读取逻辑列表
            //    UI.UI2.Intelligence.Automation.MainView.GetLogicList();
            //    #endregion
            })
            { IsBackground = true }.Start();
            //})
            //{ IsBackground = true }.Start();
            #region 读取本地数据
            //读取音乐信息
            UI.Music.A31MusicModel.ReadMusicStates();
            //搜索网关
            DriverLayer.Control.Ins.SearchLoaclGateway();
            #endregion
        }
        /// <summary>