Пример #1
0
        /// <summary>
        /// Добавление фильма
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonFilmAdd_Click(object sender, EventArgs e)
        {
            var addFilmForm = new AddEditFilmForm(this, AddEditState.Add, this.mFilmotecClass, this.mSettingClass, new FilmInfo {
                Number = Convert.ToInt32(listBoxDiskNumber.Items[listBoxDiskNumber.SelectedIndex].ToString()), Info = string.Empty, Name = string.Empty
            });

            addFilmForm.ShowDialog();
            this.mFilmInfos = this.mFilmotecClass.GetFilmInfo(this.mDiskInfos[listBoxDiskNumber.SelectedIndex].Number, textBoxFilterFilmName.Text, comboBoxFilterGenre.Text);
            DisplayInfos();
            listBoxFilmName.Focus();
        }
Пример #2
0
        /// <summary>
        /// Редактирование фильма
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonFilmEdit_Click(object sender, EventArgs e)
        {
            if (listBoxFilmName.SelectedIndex < 0)
            {
                MessageBox.Show("Фильм не выделен", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var editFilmForm = new AddEditFilmForm(this, AddEditState.Edit, this.mFilmotecClass, this.mSettingClass, this.mFilmInfos[listBoxFilmName.SelectedIndex]);

            editFilmForm.ShowDialog();
            this.mFilmInfos = this.mFilmotecClass.GetFilmInfo(this.mDiskInfos[listBoxDiskNumber.SelectedIndex].Number, textBoxFilterFilmName.Text, comboBoxFilterGenre.Text);
            for (int i = 0; i < this.mFilmInfos.Length; i++)
            {
                if (NewFilmName == this.mFilmInfos[i].Name)
                {
                    listBoxFilmName.SelectedIndex = i;
                    break;
                }
            }

            DisplayInfos();
            listBoxFilmName.Focus();
        }