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/Application.cs |   65 +++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/Crabtree/ON/Application.cs b/Crabtree/ON/Application.cs
index 3898983..6a5a33e 100644
--- a/Crabtree/ON/Application.cs
+++ b/Crabtree/ON/Application.cs
@@ -3,8 +3,8 @@
 using Android.Content;
 using Android.Net;
 using Android.OS;
-using CN.Jpush.Android.Api;
-using CN.Jpush.Android.Service;
+//using CN.Jpush.Android.Api;
+//using CN.Jpush.Android.Service;
 using Java.Lang;
 using Java.Util;
 using Java.Util.Zip;
@@ -42,12 +42,26 @@
     [Android.App.Application]
     public class Application : Android.App.Application
     {
+        static void reStartApp (Android.App.Application application)
+        {
+            var intent = new Intent (application, typeof (BaseActivity));
+            intent.AddFlags (ActivityFlags.NewTask);
+            application.StartActivity (intent);
+            Android.OS.Process.KillProcess (Android.OS.Process.MyPid ());
+        }
+
         public Application (IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base (handle, ownerShip) { }
         public override void OnCreate ()
         {
-            initAll ();
+            if (Shared.Application.Activity != null) {
+                reStartApp (this);
+                return;
+            }
+            //Shared.Application.IsGpsEnable = false;
 
             base.OnCreate ();
+
+            initAll ();
         }
 
         /// <summary>
@@ -61,10 +75,9 @@
             //BaseActivity.KeepScreenON = false;
 
 
-
             BaseActivity.BackKeyAction = () => {
                 if (Shared.SimpleControl.MainPage.Loading != null) {
-                    Console.WriteLine (MainPage.Loading.CurStatus);
+                    Utlis.WriteLine (MainPage.Loading.CurStatus);
                     if (Shared.SimpleControl.MainPage.Loading.CurStatus) {
                         Shared.SimpleControl.MainPage.Loading.Hide ();
                         return;
@@ -73,7 +86,7 @@
                 //if(BaseActivity.VerifyDateTime == DateTime.MaxValue) { } else 
                 try {
                     var lastView = Shared.Application.MainPage.GetChildren (Shared.Application.MainPage.ChildrenCount - 1);
-                    Console.WriteLine ("lastView " + lastView);
+                    Utlis.WriteLine ("lastView " + lastView);
                     if (MainPage.Loading.CurStatus) {
                         return;
                     }
@@ -82,26 +95,26 @@
                             BaseActivity.VerifyDateTime = DateTime.MaxValue;
                             return;
                         } else {
-                            Console.WriteLine ("Remove Dialog!!!!");
+                            Utlis.WriteLine ("Remove Dialog!!!!");
                             var lastView2 = Shared.Application.MainPage.GetChildren (Shared.Application.MainPage.ChildrenCount - 2);
                             lastView.RemoveFromParent ();
                             lastView2.RemoveFromParent ();
-                            Console.WriteLine ("Remove Dialog End!!!!");
+                            Utlis.WriteLine ("Remove Dialog End!!!!");
                             BaseActivity.VerifyDateTime = DateTime.MinValue;
                             return;
                         }
                     }
                 } catch (System.Exception ezx) {
-                    Console.WriteLine (ezx.Message);
+                    Utlis.WriteLine (ezx.Message);
                 }
                 if (SharedMethod.SharedMethod.CurPageLayout != null) {
                     if (SharedMethod.SharedMethod.CurPageLayout.ChildrenCount > 1) {
-                        Console.WriteLine ("Remove PageLayout Children!!!!");
+                        Utlis.WriteLine ("Remove PageLayout Children!!!!");
                         SharedMethod.SharedMethod.CurPageLayout.GetChildren (SharedMethod.SharedMethod.CurPageLayout.ChildrenCount - 1).RemoveFromParent ();
-                        Console.WriteLine ("Remove PageLayout Children End!!!!");
+                        Utlis.WriteLine ("Remove PageLayout Children End!!!!");
                         BaseActivity.VerifyDateTime = DateTime.MinValue;
                     } else {
-                        Console.WriteLine ("BaseActivity.VerifyDateTime = DateTime.MaxValue");
+                        Utlis.WriteLine ("BaseActivity.VerifyDateTime = DateTime.MaxValue");
                         BaseActivity.VerifyDateTime = DateTime.MaxValue;
                     }
                 }
@@ -113,14 +126,14 @@
             init ();
             BaseActivity.OnCreateActoin += (activity, application) => {
                 Microsoft.AppCenter.AppCenter.Start ("d0f0f0c5-88af-494b-93af-9a667801b7a3", typeof (Microsoft.AppCenter.Analytics.Analytics), typeof (Microsoft.AppCenter.Crashes.Crashes));
-                //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠�
-                var tokenID = JPushInterface.GetRegistrationID (activity);
-                if (!string.IsNullOrEmpty (tokenID) && UserConfig.Instance.tokenID != tokenID) {
-                    UserConfig.Instance.tokenID = tokenID;
-                    UserConfig.Instance.SaveUserConfig ();
-                }
+                ////淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠�
+                //var tokenID = JPushInterface.GetRegistrationID (activity);
+                //if (!string.IsNullOrEmpty (tokenID) && UserConfig.Instance.tokenID != tokenID) {
+                //    UserConfig.Instance.tokenID = tokenID;
+                //    UserConfig.Instance.SaveUserConfig ();
+                //}
                 BaseActivity.NetworkStateChanged += (int obj) => {
-                    Console.WriteLine ("NetworkStateChanged " + obj);
+                    Utlis.WriteLine ("NetworkStateChanged " + obj);
                     UserConfig.Instance.internetStatus = obj;
                     UserConfig.Instance.SaveUserConfig ();
                     //缃戠粶鍙樺寲閫氱煡
@@ -153,9 +166,9 @@
             Shared.Application.Skin = UserConfig.Instance.CurrentSkinName;
             SkinStyle.Current.ChangeColor ();
             UserConfig.Instance.phoneName = Android.OS.Build.Manufacturer;
-            //璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅
-            JPushInterface.SetDebugMode (false);
-            JPushInterface.Init (this);//淇濆瓨鎵嬫満鍚嶇О鍒版湰鍦版枃浠�
+            ////璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅
+            //JPushInterface.SetDebugMode (false);
+            //JPushInterface.Init (this);//淇濆瓨鎵嬫満鍚嶇О鍒版湰鍦版枃浠�
             //鑾峰彇缁忕含搴� 
             Shared.Application.LocationAction = (arg1, arg2) => {
 
@@ -182,12 +195,12 @@
         }
         void checkSomeInfo ()
         {
-            RemoteInfo.Current.ReadMsgList (UserConfig.Instance.tokenID, IsShowTip);
-            JPushInterface.ClearAllNotifications (this);
+            //RemoteInfo.Current.ReadMsgList (UserConfig.Instance.tokenID, IsShowTip);
+            //JPushInterface.ClearAllNotifications (this);
 
             IsShowTip = true;
             var status = isNetworkAvailable (this);
-            Console.WriteLine ("status!!!" + status);
+            Utlis.WriteLine ("status!!!" + status);
             int internetStatus = 0;
             if (status) {
                 var isWifi = isWifiConnected (this);
@@ -197,7 +210,7 @@
                     internetStatus = 1;
                 }
             }
-            Console.WriteLine ("");
+            Utlis.WriteLine ("");
             Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus, false);
         }
 

--
Gitblit v1.8.0