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);
            }
        }
        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();
            }
        }
示例#3
0
 public void Update(Person person)
 {
     FirstName = person.FirstName;
     LastName = person.LastName;
 }
示例#4
0
 public Person(Person person)
 {
     Update(person);
 }
示例#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);
 }