protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            if (e.Parameter != null)
            {
                objMesa        = (Juego)e.Parameter;
                lblMesaId.Text = objMesa.JuegoID;
                App.objJugador.IpMesaConectada = objMesa.Ip;
            }

            if (App.objJugador != null)
            {
                if (App.objJugador.Nombre != null)
                {
                    lblNombreJugador.Text = App.objJugador.Nombre;
                    lblNombre.Text        = App.objJugador.Nombre;
                }
                if (App.objJugador.Imagen != null)
                {
                    BitmapImage         bimgBitmapImage = new BitmapImage();
                    IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(App.objJugador.Imagen);

                    bimgBitmapImage.SetSource(fileStream);
                    imgJugador.Source = bimgBitmapImage;
                }
            }
            IniciarSDK();
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            //Pagina a redireccionar
            if (e.Parameter != null)
            {
                paginaRedirect = (Type)e.Parameter;
            }
            if (App.objJugador != null)
            {
                if (App.objJugador.Nombre != null)
                {
                    lblNombreJugador.Text = App.objJugador.Nombre;
                    txtNombre.Text        = App.objJugador.Nombre;
                }
                if (App.objJugador.Imagen != null)
                {
                    fotoBytes       = App.objJugador.Imagen;
                    bimgBitmapImage = new BitmapImage();
                    IRandomAccessStream fileStream = await Convertidor.ConvertImageToStream(fotoBytes);

                    bimgBitmapImage.SetSource(fileStream);
                    imgJugador.Source = bimgBitmapImage;
                    imgFoto.Source    = bimgBitmapImage;
                }
                else
                {
                    Uri         uri       = new Uri("ms-appx:///Assets/Images/Icons/logo128x128.png");
                    BitmapImage logoImage = new BitmapImage(uri);
                    imgJugador.Source = logoImage;
                }
            }
            else
            {
                if (App.DetectPlatform() == Platform.WindowsPhone)
                {
                    Uri         uri       = new Uri("ms-appx:///Assets/Images/Icons/logo128x128.png");
                    BitmapImage logoImage = new BitmapImage(uri);
                    imgJugador.Source        = logoImage;
                    PanelRegresar.Visibility = Visibility.Collapsed;
                }
                if (paginaRedirect == typeof(ElegirMesa))
                {
                    PanelRegresar.Visibility = Visibility.Collapsed;
                }
            }
        }
Beispiel #3
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            mandoActivo = false;
            //El color del jugador
            if (e != null)
            {
                var param = e.Parameter.ToString();
                var color = param.Substring(0, 8);
                TonalidadMando.Stroke = Convertidor.GetSolidColorBrush(color);

                if (param.Length > 8)
                {
                    if (param.Substring(8, 1) == "1")
                    {
                        HabilitarControles();
                    }
                    else
                    {
                        DeshabilitarControles();
                    }
                }
            }
            if (App.objJugador != null)
            {
                if (App.objJugador.Nombre != null)
                {
                    lblBienvenido.Text = App.objJugador.Nombre;
                }
                if (App.objJugador.Imagen != null)
                {
                    BitmapImage         bimgBitmapImage = new BitmapImage();
                    IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(App.objJugador.Imagen);

                    bimgBitmapImage.SetSource(fileStream);
                    imgJugador.Source = bimgBitmapImage;
                }
            }
            IniciarSDK();

            Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;

            timerMantenerConexion = new Timer(timerMantenerConexionCallback, null, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(Constantes.KeepAlive));
        }
Beispiel #4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            if (App.objJugador != null)
            {
                if (App.objJugador.Nombre != null)
                {
                    lblBienvenido.Text = App.objJugador.Nombre;
                }
                if (App.objJugador.Imagen != null)
                {
                    BitmapImage         bimgBitmapImage = new BitmapImage();
                    IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(App.objJugador.Imagen);

                    bimgBitmapImage.SetSource(fileStream);
                    imgJugador.Source = bimgBitmapImage;
                }
            }
        }
Beispiel #5
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
            if (App.objJugador != null)
            {
                if (App.objJugador.Nombre != null)
                {
                    lblBienvenido.Text = App.objJugador.Nombre;
                }
                if (App.objJugador.Imagen != null)
                {
                    BitmapImage         bimgBitmapImage = new BitmapImage();
                    IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(App.objJugador.Imagen);

                    bimgBitmapImage.SetSource(fileStream);
                    imgJugador.Source = bimgBitmapImage;
                }
            }
            lblTurno.Text         = Constantes.MensajesMando.MANDOMESAENESPERA;
            panelTurno.Background = Convertidor.GetSolidColorBrush(Constantes.Colores.COLORENESPERA);
            IniciarSDK();

            Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;

            PanelReconexionOcultar();
            timerMantenerConexion = new Timer(timerMantenerConexionCallback, null, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(Constantes.Reconexion.KeepAlive));

            if (e.Parameter != null)
            {
                var jugadorIdTurno = int.Parse(e.Parameter.ToString());
                if (jugadorIdTurno == App.objJugador.JugadorId)
                {
                    mandoActivo = false;
                    HabilitarControles();
                }
                else
                {
                    mandoActivo = true;
                    DeshabilitarControles();
                }
            }
        }
Beispiel #6
0
        private async void DibujarInfoJugadores()
        {
            lblCodigoMesa.Text = "Mesa: " + objJuego.Codigo;

            Uri                 uri;
            BitmapImage         imagen;
            IRandomAccessStream fileStream;

            //Jugador 1
            if (objJuego.Jugadores[0].Imagen != null)
            {
                imagen     = new BitmapImage();
                fileStream = await Convertidor.ConvertImageToStream(objJuego.Jugadores[0].Imagen);

                imagen.SetSource(fileStream);
                imgJugador1.Source = imagen;
            }
            lblJugador1.Text = objJuego.Jugadores[0].Nombre;
            uri    = new Uri(objJuego.Jugadores[0].Elemento.RutaImagen);
            imagen = new BitmapImage(uri);
            imgElementoJugador1.Source = imagen;

            //Jugador 2
            if (objJuego.Jugadores[1].Imagen != null)
            {
                imagen     = new BitmapImage();
                fileStream = await Convertidor.ConvertImageToStream(objJuego.Jugadores[1].Imagen);

                imagen.SetSource(fileStream);
                imgJugador2.Source = imagen;
            }
            lblJugador2.Text = objJuego.Jugadores[1].Nombre;
            uri    = new Uri(objJuego.Jugadores[1].Elemento.RutaImagen);
            imagen = new BitmapImage(uri);
            imgElementoJugador2.Source = imagen;
        }
Beispiel #7
0
        private async void MostrarDatosJugadoresEnPantalla()
        {
            Uri         uri          = new Uri(Constantes.IconoJugador);
            BitmapImage defaultImage = new BitmapImage(uri);
            Jugador     jugador;

            if (objJuego.JugadoresConectados.Count >= 1)
            {
                jugador = objJuego.JugadoresConectados[0];
                if (!lblIpJugador1.Text.Equals(jugador.Ip))
                {
                    lblIpJugador1.Text = jugador.Ip;
                    if (jugador.Imagen != null)
                    {
                        BitmapImage         bimgBitmapImage = new BitmapImage();
                        IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(jugador.Imagen);

                        bimgBitmapImage.SetSource(fileStream);
                        imgJugador1.Source = bimgBitmapImage;
                    }
                    lblJugador1.Text = jugador.Nombre;
                }
            }
            else
            {
                lblIpJugador1.Text = "0.0.0.0";
                imgJugador1.Source = defaultImage;
                lblJugador1.Text   = "Esperando...";
            }
            if (objJuego.JugadoresConectados.Count >= 2)
            {
                jugador = objJuego.JugadoresConectados[1];
                if (!lblIpJugador2.Text.Equals(jugador.Ip))
                {
                    lblIpJugador2.Text = jugador.Ip;
                    if (jugador.Imagen != null)
                    {
                        BitmapImage         bimgBitmapImage = new BitmapImage();
                        IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(jugador.Imagen);

                        bimgBitmapImage.SetSource(fileStream);
                        imgJugador2.Source = bimgBitmapImage;
                    }
                    lblJugador2.Text = jugador.Nombre;
                }
            }
            else
            {
                lblIpJugador2.Text = "0.0.0.0";
                imgJugador2.Source = defaultImage;
                lblJugador2.Text   = "Esperando...";
            }
            if (objJuego.JugadoresConectados.Count >= 3)
            {
                jugador = objJuego.JugadoresConectados[2];
                if (!lblIpJugador3.Text.Equals(jugador.Ip))
                {
                    lblIpJugador3.Text = jugador.Ip;
                    if (jugador.Imagen != null)
                    {
                        BitmapImage         bimgBitmapImage = new BitmapImage();
                        IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(jugador.Imagen);

                        bimgBitmapImage.SetSource(fileStream);
                        imgJugador3.Source = bimgBitmapImage;
                    }
                    lblJugador3.Text = jugador.Nombre;
                }
            }
            else
            {
                lblIpJugador3.Text = "0.0.0.0";
                imgJugador3.Source = defaultImage;
                lblJugador3.Text   = "Esperando...";
            }
            if (objJuego.JugadoresConectados.Count >= 4)
            {
                jugador = objJuego.JugadoresConectados[3];
                if (!lblIpJugador4.Text.Equals(jugador.Ip))
                {
                    lblIpJugador4.Text = jugador.Ip;
                    if (jugador.Imagen != null)
                    {
                        BitmapImage         bimgBitmapImage = new BitmapImage();
                        IRandomAccessStream fileStream      = await Convertidor.ConvertImageToStream(jugador.Imagen);

                        bimgBitmapImage.SetSource(fileStream);
                        imgJugador4.Source = bimgBitmapImage;
                    }
                    lblJugador4.Text = jugador.Nombre;
                }
            }
            else
            {
                lblIpJugador4.Text = "0.0.0.0";
                imgJugador4.Source = defaultImage;
                lblJugador4.Text   = "Esperando...";
            }
        }
        private async void DibujarResultadosPartida()
        {
            Uri                 uri;
            BitmapImage         imagen;
            IRandomAccessStream fileStream;

            //Dibujar Info Jugadores
            if (objJuego.Jugadores[0].Imagen != null)
            {
                imagen     = new BitmapImage();
                fileStream = await Convertidor.ConvertImageToStream(objJuego.Jugadores[0].Imagen);

                imagen.SetSource(fileStream);
                imgJugador1.Source = imagen;
            }
            lblJugador1.Text = objJuego.Jugadores[0].Nombre;
            if (objJuego.Jugadores[1].Imagen != null)
            {
                imagen     = new BitmapImage();
                fileStream = await Convertidor.ConvertImageToStream(objJuego.Jugadores[1].Imagen);

                imagen.SetSource(fileStream);
                imgJugador2.Source = imagen;
            }
            lblJugador2.Text = objJuego.Jugadores[1].Nombre;

            //Dibujar Fondos
            uri    = new Uri(objJuego.Jugadores[0].Elemento.RutaImagenFondo);
            imagen = new BitmapImage(uri);
            imgFondoJugador1.ImageSource = imagen;
            uri    = new Uri(objJuego.Jugadores[1].Elemento.RutaImagenFondo);
            imagen = new BitmapImage(uri);
            imgFondoJugador2.ImageSource = imagen;

            var mensajeResultado1 = "";
            var mensajeResultado2 = "";

            //Dibujar Elementos
            if (objJuego.JugadorIdGanador == 0)
            {
                uri = new Uri(objJuego.Jugadores[0].Elemento.RutaImagenVictoria);
                mensajeResultado1 = "GANASTE";
            }
            else
            {
                uri = new Uri(objJuego.Jugadores[0].Elemento.RutaImagenDerrota);
                mensajeResultado1 = "PERDISTE";
            }
            imagen = new BitmapImage(uri);
            imgElemento1.Source = imagen;
            if (objJuego.JugadorIdGanador == 1)
            {
                uri = new Uri(objJuego.Jugadores[1].Elemento.RutaImagenVictoria);
                mensajeResultado2 = "GANASTE";
            }
            else
            {
                uri = new Uri(objJuego.Jugadores[1].Elemento.RutaImagenDerrota);
                mensajeResultado2 = "PERDISTE";
            }
            imagen = new BitmapImage(uri);
            imgElemento2.Source = imagen;

            if (objJuego.JugadorIdGanador == Constantes.NO_ASIGNADO)
            {
                mensajeResultado1 = "EMPATE";
                mensajeResultado2 = "EMPATE";
            }
            lblResultado1.Text = mensajeResultado1;
            lblResultado2.Text = mensajeResultado2;
        }