HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-07-09 5428935270159bfc42c2934ed7fb1091554fc9a4
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlWifiLogic.cs
@@ -151,8 +151,8 @@
            }
            get
            {
                //10秒后允许再次访问
                if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 10 * 1000)
                //8秒后允许再次访问
                if (m_CanAccessHttp == true || (DateTime.Now - oldAccessHttpTime).TotalMilliseconds > 8 * 1000)
                {
                    oldAccessHttpTime = DateTime.Now;
                    return true;
@@ -368,23 +368,43 @@
        /// <summary>
        /// 监听安卓网络变化
        /// </summary>
        /// <param name="value"></param>
        /// <param name="value">0:没有网络 1:4G  2:wifi</param>
        private void NetworkStateChanged(int value)
        {
            //没有网络
            if (value == 0)
            {
                this.CanAccessHttp = false;
                //关闭Socket
                ZigBee.Common.Application.FindGateWaySocket.Stop();
            }
            //可以叫4G
            else if (value == 1)
            //WIFI或者4G时
            if (value == 1 || value == 2)
            {
                //允许联网
                this.CanAccessHttp = true;
                //检测是否已经完成账号信息初始化
                if (UserCenterResourse.UserInfo.InitUserInfoSuccess == false
                   && Common.Config.Instance.HomeId != string.Empty)
                {
                    HdlThreadLogic.Current.RunThread(() =>
                    {
                        ProgressBar.Show();
                        //重新初始化账号信息
                        UserCenterLogic.ReInitUserAccoutInfo();
                        ProgressBar.Close();
                    }, ShowErrorMode.NO);
            }
            //WIFI
            else if (value == 2)
                //重新初始化Socket
                ZigBee.Common.Application.FindGateWaySocket.Stop();
                if (value == 2)
            {
                this.CanAccessHttp = true;
                    ZigBee.Common.Application.FindGateWaySocket.Start();
                }
                //断掉本地连接
                HdlGatewayLogic.Current.ClearAllRealGateway();
            }
        }