/// <summary> /// Sets a flag that the user has launched the app before, then launches the view that is normally launched when the user enters the app. /// </summary> /// <param name="sender">Button object that was pressed.</param> private void GetStartedButton_TouchUpInside(object sender, EventArgs eventArgs) { FirstLaunchClient firstLaunch = ((AppDelegate)UIApplication.SharedApplication.Delegate).FirstLaunch; firstLaunch.WasLaunchedBefore = true; var storyboard = UIStoryboard.FromName("Main", null); UIViewController imageInputViewController = storyboard.InstantiateInitialViewController() as UIViewController; this.DismissViewController(false, null); this.PresentViewController(imageInputViewController, true, null); }
/// <summary> /// Override point for customization after application launch. /// </summary> public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { string[] lines = System.IO.File.ReadAllLines(Constants.EnvironmentPropertyFile); AnalyticsService.SetEnvironmentVariables(lines); // For more info on how to get a Visual Studio App Center API key refer to: // https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/xamarin var apiKey = System.Environment.GetEnvironmentVariable(Constants.AppCenterApiVariableKey); AnalyticsService.Start(apiKey); // Initially load the AIClient on application launch, so the first analysis goes through quickly LoadModel(); #if DEBUG // Force FirstRun to always display in DEBUG mode firstLaunch = new FirstLaunchClient( () => { return(false); }, (value) => { } ); #else firstLaunch = new FirstLaunchClient(); #endif if (!firstLaunch.WasLaunchedBefore) { System.Diagnostics.Debug.WriteLine("First launch of app"); this.Window = new UIWindow(frame: UIScreen.MainScreen.Bounds); var storyboard = UIStoryboard.FromName("FirstRun", null); FirstRunViewController firstRunViewController = storyboard.InstantiateInitialViewController() as FirstRunViewController; UINavigationController navigationController = new UINavigationController(firstRunViewController); if (this.Window != null) { this.Window.RootViewController = navigationController; this.Window.MakeKeyAndVisible(); } } return(true); }