private void typeCombo_SelectedIndexChanged(object sender, EventArgs e) { var combo = sender as ComboBox; if (combo == null) { return; } if (combo.SelectedIndex == (int)EntryType.Movie && (this as AddMovieForm) == null) { var form = new AddMovieForm(m_context); form.Location = Location; form.StartPosition = FormStartPosition.Manual; form.Show(); AddFormManager.SwitchForm(form); } if (combo.SelectedIndex == (int)EntryType.Book && (this as AddBookForm) == null) { var form = new AddBookForm(m_context); form.Location = Location; form.StartPosition = FormStartPosition.Manual; form.Show(); AddFormManager.SwitchForm(form); } }
protected override void OnOk() { m_entry.Name = nameTextbox.Text; m_entry.PublicationYear = yearTextbox.Text; SaveAuthorEntry(m_entry.Authors, m_selectedAuthors); m_context.SaveChanges(); AddFormManager.CloseForm(); }
protected override void OnOk() { var text = nameTextbox.Text; if (text.Length == 0) { MessageBox.Show("Please enter a name."); return; } if ((int)typeCombo.SelectedValue == (int)EntryType.Book) { m_entry.Name = text; m_entry.PublicationYear = yearTextbox.Text; SaveAuthorEntry(m_entry.Authors, m_selectedAuthors); m_context.Entries.Add(m_entry); m_context.SaveChanges(); } AddFormManager.CloseForm(); }
protected override void OnCancel() { AddFormManager.CloseForm(); }