private async void BtnLogin_Click(object sender, System.Windows.RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password)) { var admin = await ElectionConfigurationService.Login(new Comissioner { UserName = Username.Text, Password = Password.Password }); if (admin != null) { new MainWindow(admin).Show(); Close(); } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; Username.Focus(); } } else { await this.ShowMessageAsync("Login Error", "Please Enter Username or password to Login."); Util.Clear(this); Username.Focus(); } }
private async void BtnLogin_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(Username.Text) && !string.IsNullOrWhiteSpace(Password.Password)) { BtnLogin.IsEnabled = false; var president = await ElectionConfigurationService.Login(new Comissioner { UserName = Username.Text, Password = Password.Password, IsPresident = true }); if (president != null) { new EcChairmanLoginWindow().Show(); BtnLogin.IsEnabled = true; Close(); } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; Username.Focus(); } } else { await this.ShowMessageAsync("Login Error", "Wrong username or password."); Util.Clear(this); BtnLogin.IsEnabled = true; Username.Focus(); } }