Example #1
0
        public void WillConnect(UIScene scene, UISceneSession session, UISceneConnectionOptions connectionOptions)
        {
            // Use this method to optionally configure and attach the UIWindow `Window` to the provided UIWindowScene `scene`.
            // If using a storyboard, the `Window` property will automatically be initialized and attached to the scene.
            // This delegate does not imply the connecting scene or session are new (see UIApplicationDelegate `GetConfiguration` instead).


            //  UIApplication.shared.connectedScenes.first
            UIWindowScene WindowScene = new UIWindowScene(session, connectionOptions);

            Window = new UIWindow(WindowScene);
            var storyboard = UIStoryboard.FromName("Main", null);


            if (Auth.DefaultInstance.CurrentUser != null)
            {
                var mainViewController = storyboard.InstantiateViewController("MainViewController") as MainViewController;
                Window.RootViewController = mainViewController;
                Window?.MakeKeyAndVisible();
                this.SetWindow(Window);
            }
            else
            {
                var loginViewController = storyboard.InstantiateViewController("LoginViewController") as LoginViewController;
                Window.RootViewController = loginViewController;
                this.SetWindow(Window);
                Window?.MakeKeyAndVisible();
            }
        }
Example #2
0
        public override void PerformAction(UIWindowScene windowScene, UIApplicationShortcutItem shortcutItem, Action <bool> completionHandler)
        {
            // intercept repl item
            if (shortcutItem.LocalizedTitle.Contains("REPL"))
            {
                UIApplication.SharedApplication.RequestSceneSessionActivation(
                    ReplSceneDelegate.SceneSession,
                    new NSUserActivity("repl"),
                    new UISceneActivationRequestOptions(),
                    err => Console.WriteLine(err));

                completionHandler(false);
            }

            completionHandler(true);
        }