Ejemplo n.º 1
0
        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();*/
        }
Ejemplo n.º 2
0
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     client.EliminarPartida(JugadorSingleton.GetJugador().Username);
 }
Ejemplo n.º 3
0
 public InicioPG()
 {
     InitializeComponent();
     lblBienvenida.Content = Memorama.Languages.Resources.MensajeBienvenida + " " + JugadorSingleton.GetJugador().Username;  //Posible excepcion
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 private void Salir(object sender, ExitEventHandler e)
 {
     partidaService.EliminarPartida(JugadorSingleton.GetJugador().Username);
 }
Ejemplo n.º 6
0
 private void btnAtras_Click(object sender, RoutedEventArgs e)
 {
     this.NavigationService.Navigate(new InicioPG());
     partidaService.EliminarPartida(JugadorSingleton.GetJugador().Username); //validar error de conexión
 }