private void BtnIniciarSesion_Click(object sender, RoutedEventArgs e) { DataAccessServiceClient client = new DataAccessServiceClient(); if (CamposLlenos()) { try { if (client.Autenticar(txtUsuario.Text, txtContrasenia.Password)) { JugadorSingleton jugador = JugadorSingleton.GetJugador(client.GetJugador(txtUsuario.Text, txtContrasenia.Password)); Inicio ventanaInicio = new Inicio(); ventanaInicio.Show(); Window.GetWindow(this).Close(); client.Close(); } else { ((MetroWindow)(Application.Current.MainWindow)).ShowMessageAsync("Alerta", "Usuario y/o contraseña incorrecta"); } } catch (System.ServiceModel.EndpointNotFoundException ex) { ((MetroWindow)(Application.Current.MainWindow)).ShowMessageAsync("Alerta", "Error de conexión"); } catch (System.TimeoutException ex) { ((MetroWindow)(Application.Current.MainWindow)).ShowMessageAsync("Alerta", "Tiempo de espera agotado"); } catch (System.ServiceModel.CommunicationException ex) { ((MetroWindow)(Application.Current.MainWindow)).ShowMessageAsync("Alerta", "Tiempo de espera agotado"); } } else { ((MetroWindow)(Application.Current.MainWindow)).ShowMessageAsync("Alerta", "Campos incompletos"); } //BORRAR /*Inicio ventanaInicio = new Inicio(); * ventanaInicio.Show(); * Window.GetWindow(this).Close();*/ }
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { client.EliminarPartida(JugadorSingleton.GetJugador().Username); }
public InicioPG() { InitializeComponent(); lblBienvenida.Content = Memorama.Languages.Resources.MensajeBienvenida + " " + JugadorSingleton.GetJugador().Username; //Posible excepcion }
private void btnCrearPartida_Click(object sender, RoutedEventArgs e) { partidaService.CrearPartida(JugadorSingleton.GetJugador().Username); //Validar error de conexión lblJugadorUno.Content = JugadorSingleton.GetJugador().Username; eJugadorUno.Fill = Brushes.DarkGreen; }
private void Salir(object sender, ExitEventHandler e) { partidaService.EliminarPartida(JugadorSingleton.GetJugador().Username); }
private void btnAtras_Click(object sender, RoutedEventArgs e) { this.NavigationService.Navigate(new InicioPG()); partidaService.EliminarPartida(JugadorSingleton.GetJugador().Username); //validar error de conexión }