Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            Peliculas pelicula1 = new Peliculas("Pelicula", "Wuu", 2006, "3", "adsfadfasfdr", 2);
            Series    serie1    = new Series("Serie", "Wuu2", 2002, "1", "adsfadfasfdr", 2, 10, "Alexia");

            listaDatos.Add(pelicula1);
            listaDatos.Add(serie1);

            lista.ItemsSource = listaDatos;
        }
Exemplo n.º 2
0
        // Save
        private void btn_Guardar_Click(object sender, RoutedEventArgs e)
        {
            if (Int32.Parse(lblRating.Text) > 5 || Int32.Parse(txtRating.Text) > 5 || Int32.Parse(lblRating.Text) < 0 || Int32.Parse(txtRating.Text) < 0)
            {
                lblErrorRating.Visibility = Visibility.Visible;
            }
            else if (rdSeries.IsChecked == true)
            {
                Series serie = new Series(
                    "Serie",
                    txtTitle.Text,
                    Int32.Parse(txtYear.Text),
                    cmbGenre.SelectedIndex.ToString(),
                    txtDescription.Text,
                    Int32.Parse(txtRating.Text),
                    Int32.Parse(txtSeasons.Text),
                    txtProductor.Text
                    );

                listaDatos.Add(serie);
                lista.ItemsSource = listaDatos;

                hideFields();

                btnNuevo.Visibility     = Visibility.Visible;
                lbl_Pelicula.Visibility = Visibility.Visible;
                lbl_Serie.Visibility    = Visibility.Visible;
                lbl_Tipo.Visibility     = Visibility.Visible;
                Stackpanel.Visibility   = Visibility.Visible;
            }
            else if (rdPeliculas.IsChecked == true)
            {
                Peliculas pelicula = new Peliculas(
                    "Pelicula",
                    lblTitulo.Text,
                    Int32.Parse(lblAño.Text),
                    cmbGenero.SelectedIndex.ToString(),
                    lblDescripcion.Text,
                    Int32.Parse(lblRating.Text)
                    );

                listaDatos.Add(pelicula);
                lista.ItemsSource = listaDatos;

                hideFields();

                btnNuevo.Visibility     = Visibility.Visible;
                lbl_Pelicula.Visibility = Visibility.Visible;
                lbl_Serie.Visibility    = Visibility.Visible;
                lbl_Tipo.Visibility     = Visibility.Visible;
                Stackpanel.Visibility   = Visibility.Visible;
            }
        }