Exemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            var mov = new MovieCreator();
            var x   = listBox1.SelectedItem.ToString().Split('\t');
            var i   = x[1] == "" ? 2 : 1;

            mov.Title  = x[0];
            mov.Year   = textBox3.Text == "" ? int.Parse(x[i]) : int.Parse(textBox3.Text);
            mov.Genre  = textBox5.Text == "" ? x[i + 1] : textBox5.Text;
            mov.Type   = textBox4.Text == "" ? x[i + 2] : textBox4.Text;
            mov.Rating = textBox6.Text == "" ? int.Parse(x[i + 3]) : int.Parse(textBox6.Text);
            mov.Name   = textBox7.Text == "" ? x[i + 4] : textBox7.Text;
            desk.Edit(mov);
            button1_Click(sender, e);
            button5.Visible  = false;
            button6.Visible  = false;
            textBox2.Visible = false;
            label1.Visible   = false;
            ChageVisible(false);
        }
Exemplo n.º 2
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            var mov = new MovieCreator();
            var x   = ViewWindow.SelectedItem.ToString().Split('\t');
            var i   = x[1] == "" ? 2 : 1;

            mov.Title  = x[0];
            mov.Year   = Year.Text == "" ? int.Parse(x[i]) : int.Parse(Year.Text);
            mov.Genre  = Genre.Text == "" ? x[i + 1] : Genre.Text;
            mov.Type   = Type.Text == "" ? x[i + 2] : Type.Text;
            mov.Rating = Rating.Text == "" ? int.Parse(x[i + 3]) : int.Parse(Rating.Text);
            mov.Name   = Name.Text == "" ? x[i + 4] : Name.Text;
            desktopRepo.Edit(mov);
            View_Click(sender, e);
            Delete.Visibility = Visibility.Hidden;
            Edit.Visibility   = Visibility.Hidden;
            Title.Visibility  = Visibility.Hidden;
            TitleL.Visibility = Visibility.Hidden;
            ChangeVisible(Visibility.Hidden);
        }