| | |
| | | using Microsoft.AppCenter.Analytics; |
| | | using Microsoft.AppCenter.Crashes; |
| | | using Shared; |
| | | using Shared.SimpleControl; |
| | | using UIKit; |
| | | using UserNotifications; |
| | | |
| | |
| | | { |
| | | Utlis.WriteLine ("OnResignActivation"); |
| | | //Shared.BusSocket.Stop (); |
| | | BusSocketStop (); |
| | | //BusSocketStop (); |
| | | } |
| | | |
| | | public override void DidEnterBackground (UIApplication application) |
| | | { |
| | | SharedMethod.SharedMethod.IsBackground = true; |
| | | Utlis.WriteLine ("DidEnterBackground"); |
| | | //BusSocketStop (); |
| | | BusSocketStop (); |
| | | } |
| | | |
| | | public override void WillEnterForeground (UIApplication application) |
| | |
| | | UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; |
| | | // Called as part of the transiton from background to active state. |
| | | // Here you can undo many of the changes made on entering the background. |
| | | //BusSocketStart (); |
| | | BusSocketStart (); |
| | | } |
| | | |
| | | public override void WillTerminate (UIApplication application) |
| | |
| | | Utlis.WriteLine ("OnActivated"); |
| | | base.OnActivated (application); |
| | | |
| | | BusSocketStart (); |
| | | //BusSocketStart (); |
| | | ////有些系统版本这里启动比视图控制器快 |
| | | //if (!Shared.SimpleControl.MainPage.Showed) { |
| | | // System.Threading.Tasks.Task.Run (() => { |
| | |
| | | //com.freeview.global.Video.FVapplicationDidBecomeActive (application); |
| | | } |
| | | |
| | | //DateTime closeTime = DateTime.MinValue; |
| | | DateTime closeTime = DateTime.MinValue; |
| | | /// <summary> |
| | | /// BusSocketStop |
| | | /// </summary> |
| | | void BusSocketStop () |
| | | { |
| | | Shared.BusSocket.Stop (); |
| | | //closeTime = DateTime.Now; |
| | | closeTime = DateTime.Now; |
| | | } |
| | | |
| | | |
| | |
| | | void BusSocketStart () |
| | | { |
| | | |
| | | if (closeTime == DateTime.MinValue) { |
| | | closeTime = DateTime.Now; |
| | | } else if (closeTime.AddSeconds (20) < DateTime.Now) { |
| | | if (CommonPage.IsRemote) { |
| | | SmartHome.MqttCommon.DisConnectRemoteMqttClient ("closeTime"); |
| | | } |
| | | } |
| | | |
| | | //if (closeTime == DateTime.MinValue) { |
| | | // closeTime = DateTime.Now; |
| | | //} else if (closeTime.AddMinutes (2) > DateTime.Now) { |