Beispiel #1
0
 public MainWindow()
 {
     InitializeComponent();
     heroesLista          = Superheroe.GetSamples();
     datosTab.DataContext = heroesLista[0];
     posLista             = 1;
     totalTextBlock.Text  = posLista + "/" + heroesLista.Count.ToString();
 }
Beispiel #2
0
        public static List <Superheroe> GetSamples()
        {
            List <Superheroe> ejemplos = new List <Superheroe>();

            Superheroe ironman   = new Superheroe("Ironman", @"https://sm.ign.com/ign_latam/screenshot/default/ybbpqktez5whedr0-1592031889_31aa.jpg", true, false, true, false);
            Superheroe kingpin   = new Superheroe("Kingpin", @"https://www.comicbasics.com/wp-content/uploads/2017/09/Kingpin.jpg", false, false, false, true);
            Superheroe spiderman = new Superheroe("Spiderman", @"https://wipy.tv/wp-content/uploads/2019/08/destino-de-%E2%80%98Spider-Man%E2%80%99-en-los-Comics.jpg", true, true, true, false);

            ejemplos.Add(ironman);
            ejemplos.Add(kingpin);
            ejemplos.Add(spiderman);

            return(ejemplos);
        }
Beispiel #3
0
        private void Aceptar_Click(object sender, RoutedEventArgs e)
        {
            Superheroe heroe = new Superheroe();

            heroe.Nombre = heroenombreTextBox.Text;
            heroe.Imagen = imagenTextBox.Text;
            if ((bool)heroeRadio.IsChecked)
            {
                heroe.Heroe   = true;
                heroe.Villano = false;
                if ((bool)vengadorCheckBox.IsChecked)
                {
                    heroe.Vengador = true;
                }
                else
                {
                    heroe.Vengador = false;
                }
                if ((bool)xmenCheckBox.IsChecked)
                {
                    heroe.Xmen = true;
                }
                else
                {
                    heroe.Xmen = false;
                }
            }
            else
            {
                heroe.Heroe = false; heroe.Villano = true;
            }

            heroesLista.Add(heroe);
            posLista            = 1;
            totalTextBlock.Text = posLista + "/" + heroesLista.Count.ToString();
            MessageBox.Show("¡Superhéroe insertado con exito!", "Superhéroes", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            limpiartodo();
        }