예제 #1
0
        public async void Logon(object parameter)
        {
            Message = "Logging in...";
            // This breaks MVVM, but you can't bind to the password in a password
            // box for security reasons
            var pass = parameter as PasswordBox;

            if (pass == null)
            {
                return;
            }

            _view.IsEnabled = false;

            try
            {
                // This will throw if authentication fails
                await GitHubApi.Login(Username, pass.Password, AccessToken);

                _view.Close();
            }
            catch (Exception e)
            {
                _view.IsEnabled = true;
                Message         = "Logon failed. " + e.Message;
            }
        }