Example #1
0
        private bool PerformLogin(LoginEventArgs args)
        {
            using (var jsonClient = new JsonServiceClient(BaseUrl))
            {
                //jsonClient.SetCredentials("morten", "pass");
                jsonClient.HttpMethod = "POST";

                var login = new LoginUser
                                {
                                    Username = args.Username,
                                    Password = args.Password,
                                };
                var loginResponse = jsonClient.Send<LoginUserResponse>(login);
                if (loginResponse.Successful)
                {
                    _loginScreen.Enabled = false;
                    _loginScreen.Visible = false;
                }
                //jsonClient.AlwaysSendBasicAuthHeader = true;
                //jsonClient.SendOneWay(move);
            }
            return true;
        }
Example #2
0
 private bool TryLogin()
 {
     if (_txtPassword.Text == null)
     {
         return false;
     }
     if (_txtPassword.Text.Length < 8)
     {
         return false;
     }
     if (_txtUsername.Text == null)
     {
         return false;
     }
     if (AcceptedCredentials != null)
     {
         var args = new LoginEventArgs
                        {
                            Username = _txtUsername.Text,
                            Password = _txtPassword.Text
                        };
         AcceptedCredentials(args);
     }
     return true;
 }