private void Login_Load(object sender, EventArgs e) { (new ShowHelper()).ShowDialog(); var chkDoNotLogin = GetConfigData("ChkDoNotLogin"); ChkDoNotLogin.Checked = chkDoNotLogin == true.ToString(); var idSave = GetConfigData("CbIdSave"); if (idSave == true.ToString()) { CbIdSave.Checked = true; var id = GetConfigData("TxtId"); if (!string.IsNullOrEmpty(id)) { TxtId.Text = id; } else { TxtId.Text = IdText; } } else { TxtId.Text = IdText; } TxtPw.Text = PwText; TxtId.Focus(); TxtPw.Focus(); TxtId.Focus(); }
private async void BtnGo_Click(object sender, RoutedEventArgs e) { BtnGo.IsEnabled = false; try { if (!await Utils.PatoClient.Login(TxtUsr.Text, TxtPw.Password)) { LoginWarning.Text = "Contraseña inválida."; TxtPw.Focus(); } else { DialogResult = true; Close(); } } catch (Exception ex) { LoginWarning.Text = ex.Message; } finally { BtnGo.IsEnabled = true; } }