Esempio n. 1
0
    void Update()
    {
        if (OnlineManager.Token != null && OnlineManager.Token != "")
        {
            Deactivate();
            LoginAlert.Present();
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            if (Username.InputField.isFocused)
            {
                Password.InputField.OnPointerClick(new PointerEventData(_eventSystem));
            }
            else
            {
                Username.InputField.OnPointerClick(new PointerEventData(_eventSystem));
            }
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (_username != "" && _password != "")
            {
                ClickSignIn();
            }
        }
    }
Esempio n. 2
0
        private void GetUserAlerts(Account account)
        {
            try
            {
                if (!account.IsConnected())
                {
                    LoginAlert alert = null;
                    App.Current.Dispatcher.Invoke((Action) delegate
                    {
                        alert = new LoginAlert(account.UserId, "", account.AccountUrl);
                        OnAlertRaised(alert);
                    });
                    Task <LoginAlert> .Factory.StartNew(() => LoginAccount(account, alert));

                    return;
                }

                // GetUserAlerts
                GetUserAlertsJob job    = new GetUserAlertsJob();
                List <AlertBase> alerts = job.GetUserAlerts(account);

                QueueAlerts(alerts);
            }
            catch (Exception ex)
            {
                // Log the exception... We could optionally display the exception the the user's
                this.Logger.Log(LogLevel.Error, "Exception:", ex);
            }
        }
Esempio n. 3
0
        private LoginAlert LoginAccount(Account account, LoginAlert alert)
        {
            string result = "Success";

            try
            {
                LoginJob job = new LoginJob();

                job.Login(account);
            }
            catch (Exception ex)
            {
                result = "Failure.";
                App.Current.Dispatcher.Invoke((Action) delegate
                {
                    ExceptionAlert exceptionAlert = new ExceptionAlert(ex);
                    OnAlertRaised(exceptionAlert);
                });
            }

            // Blocking call to the dispatcher.
            App.Current.Dispatcher.Invoke((Action) delegate
            {
                alert.Detail += result;
            });

            return(alert);
        }
Esempio n. 4
0
        public IActionResult Login(string returnUrl, LoginAlert alert)
        {
            if (User?.Identity.IsAuthenticated == true)
            {
                return(RedirectToAction(nameof(HomeController.Overview)));
            }

            var language = CultureInfo.CurrentCulture.Name;

            var viewModel = new LoginViewModel
            {
                ReturnUrl = returnUrl,
                Alert     = alert
            };

            if (returnUrl != null)
            {
                if (returnUrl.Contains("to-do-assistant", StringComparison.OrdinalIgnoreCase))
                {
                    viewModel.ButtonLabel = LoginButtonLabel.ToDoAssistant;
                }
                else if (returnUrl.Contains("cooking-assistant", StringComparison.OrdinalIgnoreCase))
                {
                    viewModel.ButtonLabel = LoginButtonLabel.CookingAssistant;
                }
                else if (returnUrl.Contains("accountant", StringComparison.OrdinalIgnoreCase))
                {
                    viewModel.ButtonLabel = LoginButtonLabel.Accountant;
                }
            }

            return(View(viewModel));
        }
Esempio n. 5
0
 static void GetInstance()
 {
     if (_instance == null)
     {
         _instance = Load("Alerts/LoginAlert", UIAlertController.Instance.CanvasRect) as LoginAlert;
     }
 }
Esempio n. 6
0
        private Task <LoginAlert> LoginAccountAsync(Account account)
        {
            LoginAlert alert = null;

            App.Current.Dispatcher.Invoke((Action) delegate
            {
                alert = new LoginAlert(account.UserId, "", account.AccountUrl);
                OnAlertRaised(alert);
            });
            return(Task <LoginAlert> .Factory.StartNew(() => LoginAccount(account, alert)));
        }