public MainWindow() { InitializeComponent(); numeroLista = 0; //Inicializamos el número de la lista superheroes = Superheroe.GetSamples(); //Inicializamos nuestra lista de superhéroes heroeRadioButton.IsChecked = true; //Inicializamos el radiobutton de heroe a true actualizarDatos(superheroes[0]); }
private void aceptarButton_Click(object sender, RoutedEventArgs e) { superVariable = (Superheroe)this.Resources["superVariable"]; superheroes.Add(superVariable); this.Resources.Remove("superVariable"); this.Resources.Add("superVariable", new Superheroe { Heroe = true }); MessageBox.Show("Superhéroe insertado con éxito", "aceptar", MessageBoxButton.OK, MessageBoxImage.Information); actualizarDatos(superheroes[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); }
private void actualizarDatos(Superheroe superheroe) { verSuperheroeGrid.DataContext = superheroe;//Asignamos el superheroe a la ventana avanzarTextBlock.Text = superheroes.Count.ToString(); retrocederTextBlock.Text = (numeroLista + 1).ToString(); }