Exemplo n.º 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (CurrentDirector == null) return;

            Person directorCopy = new Person(CurrentDirector);

            using (EditDirectorDialog dlg = new EditDirectorDialog(directorCopy))
            {
                dlg.StartPosition = FormStartPosition.CenterParent;
                if (dlg.ShowDialog() != DialogResult.OK) return;

                CurrentDirector.Update(directorCopy);
            }
        }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Person director = new Person();

            using (EditDirectorDialog dlg = new EditDirectorDialog(director))
            {
                dlg.StartPosition = FormStartPosition.CenterParent;
                if (dlg.ShowDialog() != DialogResult.OK) return;

                _movieRepository.Add(director);
                lstDirectors.SelectedItem = director;
                UpdateButtons();
            }
        }
Exemplo n.º 3
0
 public void Update(Person person)
 {
     FirstName = person.FirstName;
     LastName = person.LastName;
 }
Exemplo n.º 4
0
 public Person(Person person)
 {
     Update(person);
 }
Exemplo n.º 5
0
 public EditDirectorDialog(Person owner)
     : this()
 {
     txtFirst.DataBindings.Add("Text", owner, "FirstName", true, DataSourceUpdateMode.OnPropertyChanged);
     txtLast.DataBindings.Add("Text", owner, "LastName", true, DataSourceUpdateMode.OnPropertyChanged);
 }