| | |
| | | //} |
| | | |
| | | //网络变化处理 |
| | | HDLCommon.Current.UpdateInternetStatus((int)internetStatus, IsEnterBackground); |
| | | HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground); |
| | | }; |
| | | //开启定位服务 |
| | | Shared.Application.StartGPSLocationService(); |
| | |
| | | |
| | | int mCount; |
| | | |
| | | ///// <summary> |
| | | ///// 是否进入后台 |
| | | ///// </summary> |
| | | //public bool IsEnterBackground = false; |
| | | |
| | | /// <summary> |
| | | /// 是否进入后台 |
| | | /// 进入后台的时间 |
| | | /// </summary> |
| | | public bool IsEnterBackground = false; |
| | | DateTime CloseTime = DateTime.Now; |
| | | |
| | | /// <summary> |
| | | /// BusSocketStop |
| | | /// </summary> |
| | | void BusSocketStop() |
| | | { |
| | | IsEnterBackground = true; |
| | | //BusSocket.Stop(); |
| | | //IsEnterBackground = true; |
| | | CloseTime = DateTime.Now; |
| | | MainPage.IsEnterBackground = true; |
| | | //进入后台mqtt正在连接重置状态 |
| | | HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false; |
| | | HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop(); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// BusSocketStart |
| | | /// </summary> |
| | | void BusSocketStart() |
| | | { |
| | | IsEnterBackground = false; |
| | | //IsEnterBackground = false; |
| | | |
| | | //BusSocket.Start(); |
| | | if (CloseTime.AddSeconds(10) < DateTime.Now) |
| | | { |
| | | //后台超过10s就断开MQTT重连 |
| | | if (HDL_ON.DriverLayer.Control.Ins.IsRemote) |
| | | { |
| | | HDL_ON.DAL.Mqtt.MqttClient.DisConnectRemote("closeTime", false); |
| | | } |
| | | } |
| | | |
| | | MainPage.IsEnterBackground = false; |
| | | HDL_ON.DriverLayer.UdpSocket._BusSocket.Start(); |
| | | HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |