Ejemplo n.º 1
0
        public void BeginLogin()
        {
#if WPF
            //not needed, handled in XAML
            if (PasswordField != null)
            {
                Password = PasswordField.Password;
            }
#else
            // Needed so if ENTER was pressed in one of the fields, it's binding will be updated.
            BindingExpression userNamedBindingExpression = UserNameField.GetBindingExpression(TextBox.TextProperty);
            userNamedBindingExpression.UpdateSource();
            BindingExpression passwordBindingExpression = PasswordField.GetBindingExpression(PasswordBox.PasswordProperty);
            passwordBindingExpression.UpdateSource();
#endif

            BusyStatusText = "Logging in...";
            IsBusy         = true;
            _canLogin      = false;

            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Login"));
            }

            if (LoginButton != null)
            {
                LoginButton.IsEnabled = false;
            }

            _context.CreateSession(UserName, Password, _context.PreferredSite, "", AuthenticationMode, AppContext_AuthenticationCompleted);
        }