Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // relies on override to point its canvas at our OnPaintSample
            // see ViewDidLayoutSubviews for triggering EditCredentials
            DrawXSettingsManager.InitLocalSettings();

            if (DrawXSettingsManager.HasCredentials())
            {
                // assume we can login and be able to draw
                // TODO handle initial failure to login despite saved credentials
                SetupDrawer();
            }
        }
Esempio n. 2
0
        private void EditCredentials()
        {
            var dialog = new LoginDialog();

            dialog.OnCloseLogin = (bool changedServer) =>
            {
                if (changedServer || _drawer == null)
                {
                    if (DrawXSettingsManager.HasCredentials())
                    {
                        SetupDrawer();  // pointless unless contact server
                        _drawer.LoginToServerAsync();
                    }
                    //// TODO allow user to launch locally if server not available
                }

                _canvas.Invalidate();
            };

            dialog.Show(FragmentManager, "login");
        }
Esempio n. 3
0
        // invoked as callback from pressing a control area in drawing surface, or at startup
        private void EditCredentials()
        {
            var sb      = UIStoryboard.FromName("LoginScreen", null);
            var loginVC = sb.InstantiateViewController("Login") as LoginViewController;

            loginVC.OnCloseLogin = (bool changedServer) =>
            {
                DismissModalViewController(false);
                if (changedServer || _drawer == null)
                {
                    if (DrawXSettingsManager.HasCredentials())
                    {
                        SetupDrawer();
                        _drawer.LoginToServerAsync();
                    }
                    //// TODO allow user to launch locally if server not available
                }

                View.SetNeedsDisplay();
            };
            PresentViewController(loginVC, false, null);
        }
Esempio n. 4
0
        protected override void OnStart()
        {
            base.OnStart();
            if (_drawer == null)
            {
                if (DrawXSettingsManager.HasCredentials())
                {
                    // assume we can login and be able to draw
                    // TODO handle initial failure to login despite saved credentials
                    SetupDrawer();
                }
            }

            if (DrawXSettingsManager.LoggedInUser != null)
            {
                _drawer.LoginToServerAsync(DrawXSettingsManager.LoggedInUser);
                _hasShownCredentials = true;  // skip credentials if saved user in store
            }
            if (!_hasShownCredentials)
            {
                EditCredentials();
                _hasShownCredentials = true;
            }
        }