From 2d414e3b007f750cdad4f9e4a7c04db696bca5e4 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 23 四月 2020 16:13:59 +0800
Subject: [PATCH] 2020-04-23 1.优化远程连接提示,改为Loading方案,防止连接过程用户点击重连图标。 2.点击网络检测图标会判断,是否正在远程连接,如果是,会弹窗提示用户”正在远程连接,是否仍要重新检测“。 3.Help 增加隐藏长按功能,长按后,可以开启远程过程异常弹窗提示。长按后关闭。

---
 Crabtree/ON.Ios/AppDelegate.cs |   72 ++++++++++++++++++++++++++++++++---
 1 files changed, 65 insertions(+), 7 deletions(-)

diff --git a/Crabtree/ON.Ios/AppDelegate.cs b/Crabtree/ON.Ios/AppDelegate.cs
index 5d47357..6942a4c 100644
--- a/Crabtree/ON.Ios/AppDelegate.cs
+++ b/Crabtree/ON.Ios/AppDelegate.cs
@@ -191,13 +191,15 @@
         public override void OnResignActivation (UIApplication application)
         {
             Utlis.WriteLine ("OnResignActivation");
-            Shared.BusSocket.Stop ();
+            //Shared.BusSocket.Stop ();
+            BusSocketStop ();
         }
 
         public override void DidEnterBackground (UIApplication application)
         {
             SharedMethod.SharedMethod.IsBackground = true;
             Utlis.WriteLine ("DidEnterBackground");
+            //BusSocketStop ();
         }
 
         public override void WillEnterForeground (UIApplication application)
@@ -209,6 +211,7 @@
             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 ();
         }
 
         public override void WillTerminate (UIApplication application)
@@ -222,6 +225,61 @@
             Utlis.WriteLine ("OnActivated");
             base.OnActivated (application);
 
+            BusSocketStart ();
+            ////鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇�
+            //if (!Shared.SimpleControl.MainPage.Showed) {
+            //    System.Threading.Tasks.Task.Run (() => {
+            //        while (true) {
+            //            System.Threading.Thread.Sleep (10);
+            //            if (Shared.SimpleControl.MainPage.Showed) {
+            //                break;
+            //            }
+            //        }
+            //        Shared.Application.RunOnMainThread (() => {
+            //            Shared.BusSocket.Start (6000);
+            //            Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (),false);
+            //            //RemoteInfo.Current.ReadMsgList (NSUserDefaults.StandardUserDefaults.StringForKey ("PushDeviceToken"), true);
+            //            if (SmartHome.WiFiSet.refreshView != null) {
+            //                SmartHome.WiFiSet.refreshView ();
+            //            }
+            //        });
+            //    });
+            //    return;
+            //}
+            //Shared.BusSocket.Start (6000);
+            //Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (), false);
+            //if (SmartHome.WiFiSet.refreshView != null) {
+            //    SmartHome.WiFiSet.refreshView ();
+            //}
+
+
+            //com.freeview.global.Video.FVapplicationDidBecomeActive (application);
+        }
+
+        //DateTime closeTime = DateTime.MinValue;
+        /// <summary>
+        /// BusSocketStop
+        /// </summary>
+        void BusSocketStop ()
+        {
+            Shared.BusSocket.Stop ();
+            //closeTime = DateTime.Now;
+        }
+
+
+        /// <summary>
+        /// BusSocketStart
+        /// </summary>
+        void BusSocketStart ()
+        {
+
+            //if (closeTime == DateTime.MinValue) {
+            //    closeTime = DateTime.Now;
+            //} else if (closeTime.AddMinutes (2) > DateTime.Now) {
+            //    // MqttCommon.DisConnectRemoteMqttClient ();
+            //}
+
+            var netStatus = (int)Reachability.InternetConnectionStatus ();
             //鏈変簺绯荤粺鐗堟湰杩欓噷鍚姩姣旇鍥炬帶鍒跺櫒蹇�
             if (!Shared.SimpleControl.MainPage.Showed) {
                 System.Threading.Tasks.Task.Run (() => {
@@ -233,23 +291,23 @@
                     }
                     Shared.Application.RunOnMainThread (() => {
                         Shared.BusSocket.Start (6000);
-                        Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (),false);
-                        //RemoteInfo.Current.ReadMsgList (NSUserDefaults.StandardUserDefaults.StringForKey ("PushDeviceToken"), true);
+                        Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (netStatus, false);
+                        //RemoteInfo.Current.ReadMsgList (true);
                         if (SmartHome.WiFiSet.refreshView != null) {
                             SmartHome.WiFiSet.refreshView ();
                         }
                     });
                 });
                 return;
+            } else {
+                Shared.BusSocket.Start (6000);
+                Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (netStatus, false);
+                //RemoteInfo.Current.ReadMsgList (true);
             }
-            Shared.BusSocket.Start (6000);
-            Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (), false);
             if (SmartHome.WiFiSet.refreshView != null) {
                 SmartHome.WiFiSet.refreshView ();
             }
 
-
-            //com.freeview.global.Video.FVapplicationDidBecomeActive (application);
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0