Ejemplo n.º 1
0
        private void edit_btn_Click(object sender, EventArgs e)
        {
            //запоминаем индекс выделенного элемента
            int index = Film_list.SelectedIndex;

            var filmForEdit = repository.Films
                .Where(f => f.Title == (string)Film_list.SelectedItem)
                .FirstOrDefault();

            editForm = new EditForm(ref filmForEdit);
            editForm.ShowDialog();
            RefreshCurrentList(repository.Films);
            //возвращаем фокус
            //Film_list.SelectedItem = index;
        }
Ejemplo n.º 2
0
        private void AddFiml_bnt_Click(object sender, EventArgs e)
        {

            Film newFilm = new Film();
            repository.AddFilm(newFilm);
            editForm = new EditForm(ref newFilm);
            DialogResult dr = editForm.ShowDialog();
            if (dr != DialogResult.OK)
                repository.RemoveFilm(repository.Films.Last().FilmID); 
            RefreshCurrentList(repository.Films);
            //if(repository.Films.Count()>=1)
            //    Film_list.SetSelected(repository.Films.Count() - 1, true);
        }