From 9ca2281d589fbd4b35177d1846974f17d12095ae Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 16 四月 2020 15:12:02 +0800
Subject: [PATCH] 2020-04-16 1.更新
---
Crabtree/ON/Application.cs | 62 +++++++++++++++++++------------
1 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/Crabtree/ON/Application.cs b/Crabtree/ON/Application.cs
index 3898983..dbcbd0a 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>
@@ -64,7 +78,7 @@
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 +87,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 +96,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 +127,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 +167,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) => {
@@ -183,11 +197,11 @@
void checkSomeInfo ()
{
RemoteInfo.Current.ReadMsgList (UserConfig.Instance.tokenID, IsShowTip);
- JPushInterface.ClearAllNotifications (this);
+ //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 +211,7 @@
internetStatus = 1;
}
}
- Console.WriteLine ("");
+ Utlis.WriteLine ("");
Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus, false);
}
--
Gitblit v1.8.0