using System;
|
using AdSupport;
|
using com.hdl.on;
|
using Foundation;
|
using Shared;
|
using UIKit;
|
using UserNotifications;
|
|
|
namespace SharedMethod
|
{
|
public static class SharedMethod
|
{
|
public static UIApplication sharedApp;
|
public static void ChangeSkin ()
|
{
|
sharedApp.StatusBarStyle = UIStatusBarStyle.Default;
|
}
|
public static PageLayout CurPageLayout = null;
|
public static bool IsBackground;
|
}
|
|
}
|
namespace ON.Ios
|
{
|
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.FinishLaunching
|
[Register ("AppDelegate")]
|
public class AppDelegate : BaseDelegate // BaseApplicationDelegateForHdlOn
|
{
|
public override UIWindow Window{
|
get;
|
set;
|
}
|
|
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
|
{
|
Console.WriteLine ("FinishedLaunching");
|
base.FinishedLaunching (application, launchOptions);
|
|
SharedMethod.SharedMethod.sharedApp = application;
|
|
Window = new UIWindow (UIScreen.MainScreen.Bounds);
|
var Root = new UINavigationController (new ViewController ()) { NavigationBarHidden = true };
|
Window.RootViewController = Root;
|
Window.MakeKeyAndVisible ();
|
application.StatusBarStyle = UIStatusBarStyle.DarkContent;
|
Shared.Application.Skin = "Phone2";
|
SkinStyle.Current.ChangeColor ();
|
|
return true;
|
}
|
|
|
public override void OnResignActivation (UIApplication application)
|
{
|
Console.WriteLine ("OnResignActivation");
|
Shared.BusSocket.Stop ();
|
}
|
|
public override void DidEnterBackground (UIApplication application)
|
{
|
SharedMethod.SharedMethod.IsBackground = true;
|
Console.WriteLine ("DidEnterBackground");
|
}
|
|
public override void WillEnterForeground (UIApplication application)
|
{
|
SharedMethod.SharedMethod.IsBackground = false;
|
}
|
|
public override void WillTerminate (UIApplication application)
|
{
|
Console.WriteLine ("WillTerminate");
|
}
|
|
public override void OnActivated (UIApplication application)
|
{
|
Console.WriteLine ("OnActivated");
|
base.OnActivated (application);
|
|
//有些系统版本这里启动比视图控制器快
|
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);
|
});
|
});
|
return;
|
}
|
Shared.BusSocket.Start (6000);
|
}
|
}
|
}
|