Beispiel #1
0
 void InitAuthorization()
 {
     btnLogin.Enabled = false;
     user = null;
     authService = new AuthenticationService();
     lblUserName.Text = string.Empty;
 }
Beispiel #2
0
 void LoginUser()
 {
     InitAuthorization();
     user = authService.Authenticate(txtUserName.Text, txtPassword.Text);
     if (user != null && user.UserName != string.Empty)
         lblUserName.Text = string.Format("Hello {0}!", user.FirstName);
     else
         lblUserName.Text = "Login Failed!";
     CleanUp();
 }
Beispiel #3
0
 async void LoginUserAsync()
 {
     InitAuthorization();
     user = await Task.Factory.StartNew<AuthenticatedUser>(() =>
     {
         return authService.Authenticate(txtUserName.Text, txtPassword.Text);
     });
     if (user != null && user.UserName != string.Empty)
         lblUserName.Text = string.Format("Hello {0}!", user.FirstName);
     else
         lblUserName.Text = "Login Failed!";
     CleanUp();
 }