private void Button_Click_1(object sender, RoutedEventArgs e) { if (neg.ComprobarLogin(datoUsu.Text, pass.Password, usuarios)) { FormularioPrincipal formPrincipal = new FormularioPrincipal(this, neg); formPrincipal.Show(); this.Visibility = Visibility.Hidden; } else { aceptar.Visibility = Visibility.Collapsed; error.Visibility = Visibility.Visible; errorIntentos.Visibility = Visibility.Visible; intentos -= 1; errorIntentos.Content = "Acceso denegado....intentos restantes: " + intentos.ToString(); if (intentos < 1) { this.Close(); } } }