/// <summary> /// Constructor de la clase /// </summary> /// <param name="juego">Clase de la funcionalidad de la ventana</param> /// <param name="jugador">Jugador actual</param> /// <param name="partida">Partida en curso</param> /// <param name="jugadoresConectados">Coleccion de jugadores concetados</param> public Juego(JuegoMemorama juego, Jugador jugador, Partida partida, ObservableCollection <Jugador> jugadoresConectados) { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; InitializeComponent(); this.jugadores = jugadoresConectados; contexto = new InstanceContext(this); contextoEstadisticas = new InstanceContext(this); servidor = new ProxyJuego.JuegoServiceClient(contexto); servidorEstadisticas = new ProxyEstadisticas.EstadisticasServiceClient(); this.partida = partida; jugadoresJuego = new ObservableCollection <Jugador>(); puntajesJugadores = new ObservableCollection <int>(); jugadoresEnLinea = new ObservableCollection <string>(); estadisticaJugador = new EstadisticaPartida(); jugadoresQueReportan = new ObservableCollection <string>(); this.jugador = jugador; this.juego = juego; TxtNombreJugador.Text = jugador.nickName; servidor.ConectarseJuego(jugador); servidor.InicializarPuntajes(jugador, 0); foreach (Jugador j in jugadoresJuego) { jugadoresEnLinea.Add(j.nickName); } jugadoresEnJuego.Items.Clear(); jugadoresEnJuego.ItemsSource = jugadoresJuego; puntajes.Items.Clear(); puntajes.ItemsSource = puntajesJugadores; }
public Puntajes(ObservableCollection <Jugador> jugadores, Jugador jugador) { InitializeComponent(); servidor = new ProxyEstadisticas.EstadisticasServiceClient(); puntajes = new int[10]; players = new string[10]; coleccionTabla = new ObservableCollection <Tabla>(); this.jugadoresConectados = jugadores; this.jugador = jugador; try { servidor.GenerarTablaDePuntajes(); } catch (CommunicationException ex) { MessageBox.Show(ex.ToString()); } puntajes = servidor.ObtenerPuntaje(); players = servidor.ObtenerJugadores(); int contadorLista = 0; foreach (var p in players) { Tabla tabla = new Tabla(); tabla.jugador = p; tabla.puntaje = puntajes[contadorLista]; coleccionTabla.Add(tabla); contadorLista++; } listaViewPuntajes.Items.Clear(); listaViewPuntajes.ItemsSource = coleccionTabla; }