Created
August 21, 2017 15:41
-
-
Save Kikimora/a6dac343a35c183df645c0037ef139b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Register("AppDelegate")] | |
public class AppDelegate : UIApplicationDelegate | |
{ | |
public override UIWindow Window | |
{ | |
get; | |
set; | |
} | |
public EmbeddedSafariLoginPage LoginPage { get; private set; } | |
public MainMenuController MainMenuController; | |
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) | |
{ | |
Console.WriteLine($"App Startup Started: {Application.StartupStopwatch.ElapsedMilliseconds}"); | |
application.StatusBarStyle = UIStatusBarStyle.LightContent; | |
MainMenuController = new MainMenuController(); | |
LoginPage = new EmbeddedSafariLoginPage(MainMenuController); | |
Console.WriteLine($"App Startup - ProveoContext.Init: {Application.StartupStopwatch.ElapsedMilliseconds}"); | |
ProveoContext.Init(new ContextParameters() | |
{ | |
LoginPage = LoginPage, | |
DbFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal) | |
}); | |
Console.WriteLine($"App Startup - ProveoContext.Init Finished: {Application.StartupStopwatch.ElapsedMilliseconds}"); | |
Log.Logger = new LoggerConfiguration() | |
.MinimumLevel.Verbose() | |
.WriteTo.NSLog() | |
.CreateLogger(); | |
#pragma warning disable CS1702 // Assuming assembly reference matches identity | |
ProveoContext.LoggerFactory.AddProvider(new SerilogLoggerProvider()); | |
#pragma warning restore CS1702 // Assuming assembly reference matches identity | |
Window = Window ?? new UIWindow(); | |
Window.RootViewController = MainMenuController; | |
Window.MakeKeyAndVisible(); | |
Application.StartupStopwatch.Stop(); | |
Console.WriteLine($"App Startup Finished: {Application.StartupStopwatch.ElapsedMilliseconds}"); | |
return true; | |
} | |
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) | |
{ | |
var processed = LoginPage.FinishLogin(url); | |
return true; | |
} | |
public override void OnActivated(UIApplication application) | |
{ | |
} | |
public override void OnResignActivation(UIApplication application) | |
{ | |
} | |
public override void DidEnterBackground(UIApplication application) | |
{ | |
// Use this method to release shared resources, save user data, invalidate timers and store the application state. | |
// If your application supports background exection this method is called instead of WillTerminate when the user quits. | |
} | |
public override void WillEnterForeground(UIApplication application) | |
{ | |
// Called as part of the transiton from background to active state. | |
// Here you can undo many of the changes made on entering the background. | |
} | |
public override void WillTerminate(UIApplication application) | |
{ | |
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment