private static void actualizarCrupier() { Application.Current.Dispatcher.Invoke(new Action(() => { Crupier crup = mesa.Crupier; ((WrapPanel)crupier["wpBorder"]).Children.Clear(); for (int i = 0; i < crup.mano.Count; i++) { Carta cart = crup.mano[i]; string tipo = cart.Tipo.ToString(); string simbolo = cart.Simbolo.ToString(); Border borderImage; if (i == crup.mano.Count - 1) { borderImage = crearImage(tipo + simbolo, -30, 0, 0, 0, 45, 70); } else { borderImage = crearImage("CartaDetras", -30, 0, 0, 0, 45, 70); } ((WrapPanel)crupier["wpBorder"]).Children.Add(borderImage); } })); }
private static void agregarJugador(Dictionary <string, object> jugador) { if ((bool)jugador["Estado"] != false) { Application.Current.Dispatcher.Invoke(new Action(() => { WrapPanel wpBorder = new WrapPanel(); for (int i = 0; i < (int)jugador["CantidadCartas"]; i++) { Carta cart = ((List <Carta>)jugador["Cartas"])[i]; string tipo = cart.Tipo.ToString(); string simbolo = cart.Simbolo.ToString(); Border borderImage = crearImage(tipo + simbolo, -30, 0, 0, 0, 45, 70); wpBorder.Children.Add(borderImage); } StackPanel sp = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Right }; TextBlock tbNombre = new TextBlock { Width = 150, TextAlignment = TextAlignment.Center, FontSize = 14, Margin = new Thickness(10, 0, 10, 0), Text = jugador["Nombre"].ToString() }; sp.Children.Add(tbNombre); TextBlock tbMontoTotal = new TextBlock { Width = 150, Margin = new Thickness(10, 0, 10, 0), Text = "Dinero Total: " + jugador["Monto"].ToString() }; sp.Children.Add(tbMontoTotal); TextBlock tbApuesta = new TextBlock { Width = 150, Margin = new Thickness(10, 0, 10, 0), Text = "Apuesta: " + jugador["Apuesta"].ToString() }; sp.Children.Add(tbApuesta); WrapPanel wpJugador = new WrapPanel() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 5, 0, 5) }; wpJugador.Children.Add(wpBorder); wpJugador.Children.Add(sp); spJugador.Children.Add(wpJugador); jugador.Add("wpJugador", wpJugador); jugador.Add("wpBorder", wpBorder); jugador.Add("tbMontoTotal", tbMontoTotal); jugador.Add("tbApuesta", tbApuesta); listjugadores.Add(jugador); })); } //spJugador.Children.Add(); }
private static void agregarCrupier() { Application.Current.Dispatcher.Invoke(new Action(() => { crupier = new Dictionary <string, object>(); Crupier crup = mesa.Crupier; WrapPanel wpBorder = new WrapPanel(); for (int i = 0; i < crup.mano.Count; i++) { Carta cart = crup.mano[i]; string tipo = cart.Tipo.ToString(); string simbolo = cart.Simbolo.ToString(); Border borderImage; if (i == crup.mano.Count - 1) { borderImage = crearImage(tipo + simbolo, -30, 0, 0, 0, 45, 70); } else { borderImage = crearImage("CartaDetras", -30, 0, 0, 0, 45, 70); } wpBorder.Children.Add(borderImage); } StackPanel sp = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Right }; Grid grid = new Grid() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Height = 70 }; TextBlock tbNombre = new TextBlock { Width = 150, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FontSize = 14, Margin = new Thickness(10, 0, 10, 0), Text = "Crupier" }; grid.Children.Add(tbNombre); sp.Children.Add(grid); WrapPanel wpJugador = new WrapPanel() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 5, 0, 5) }; wpJugador.Children.Add(wpBorder); wpJugador.Children.Add(sp); spJugador.Children.Add(wpJugador); crupier.Add("wpJugador", wpJugador); crupier.Add("wpBorder", wpBorder); })); //spJugador.Children.Add(); }