private async void btn_login_Click(object sender, RoutedEventArgs e) { progress_bar.Visibility = Visibility.Visible; btn_login.IsEnabled = false; LoginRequest loginRequest = new LoginRequest { username = txt_username.Text, password = txt_password.Password }; LoginResponse loginResponse = await RestAPI.PostLogin(loginRequest); progress_bar.Visibility = Visibility.Collapsed; if (loginResponse.token != null) { LoginResponse.access_token = loginResponse.token; if (send != null) { send.Invoke(); this.Close(); } } else { MessageBox.Show("Login Fail"); btn_login.IsEnabled = true; } }
public void OnLoginClick(Dictionary <string, string> vars) { if (LoginClick != null) { LoginClick.Invoke(this, vars); } }
private async void login() { loginProgressBar.Visible = true; var loginTask = new Task <Result>(() => { return(LoginClick.Invoke(Login, Password)); }); loginTask.Start(); var loginResult = await loginTask; loginProgressBar.Visible = false; if (loginResult.Success) { onSuccessLoginAttempt(); } else { onFailedLoginAttempt(loginResult); } }
private void LoginBtn_Click(object sender, EventArgs e) { LoginClick?.Invoke(sender, EventArgs.Empty); }
protected virtual void OnLoginClick(string user, string password) { LoginClick?.Invoke(this, user, password); }
protected void btnLoginButton_Click(object sender, EventArgs e) { LoginClick?.Invoke(this, EventArgs.Empty); }
public void LogIn() { LoginClick?.Invoke(this, new LoginEventArgs(UsernameText, PasswordText)); }
private void Login_OnClick(object sender, RoutedEventArgs e) { LoginClick?.Invoke(); }
private void btnLogin_Click(object sender, EventArgs e) { LoginClick?.Invoke(this, e); }