// This creates a Character edit form using the constructor that adds // new Characters private void btnAdd_Click(object sender, EventArgs e) { var addForm = new CharacterEditForm(); addForm.ShowDialog(); _characterManager = new CharacterManager(); populateList(); }
// This creates a Character edit form using the constructor that edits // existing Characters private void btnEdit_Click(object sender, EventArgs e) { if (this.lstCharacter.SelectedIndices.Count > 0) { var editForm = new CharacterEditForm(lstCharacter.SelectedIndices[0], _characterManager); editForm.ShowDialog(); _characterManager = new CharacterManager(); populateList(); } else { MessageBox.Show("Please make a selection."); } }