private void OnCharacterEdit(object sender, EventArgs e) { var form = new CharacterForm(); var character = GetSelectedCharacter(); if (character == null) { return; } form.Character = character; while (true) { if (form.ShowDialog(this) != DialogResult.OK) { return; } try { _characters.Update(character.Id, form.Character); break; } catch (Exception ex) { DisplayError(ex); }; } ; BindList(); }
private void OnCharacterAdd(object sender, EventArgs e) { //Display UI var form = new CharacterForm(); while (true) { //Modal if (form.ShowDialog(this) != DialogResult.OK) { return; } //Add try { OnSafeAdd(form); break; } catch (InvalidOperationException) { MessageBox.Show(this, "Pick Again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { //Recover from errors DisplayError(ex); }; } ; BindList(); }
private void OnCharacterEdit(object sender, EventArgs e) { // display UI var form = new CharacterForm(); // change form title form.Text = "Edit Character"; var character = _listCharacters.SelectedItem as Character; if (character == null) { return; } form.Character = character; // update list with new character while (true) { if (form.ShowDialog(this) != DialogResult.OK) { return; } _roster.Update(character.Id, form.Character); break; } BindList(); }
private void OnCharacterAdd(object sender, EventArgs e) { var form = new CharacterForm(); while (true) { if (form.ShowDialog(this) != DialogResult.OK) { return; } try { OnSafeAdd(form); break; } catch (InvalidOperationException) { MessageBox.Show(this, "Choose a better character.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { DisplayError(ex); }; } ; BindList(); }
private void OnCharacterEdit(object sender, EventArgs e) { //Get selected character var character = GetSelectedCharacters(); if (character == null) { return; } var form = new CharacterForm("Edit Character"); form.Character = character; if (form.ShowDialog(this) != DialogResult.OK) { return; } try { _characters.Update(character.Id, form.Character); UpdateUI(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OnCharacterNew(object sender, EventArgs e) { //Display UI var form = new CharacterForm(); form.Text = "Create New Kaiju"; while (true) { //Modal if (form.ShowDialog(this) != DialogResult.OK) { return; } //Add try { OnSafeAdd(form); break; } catch (Exception ex) { //Recover from errors DisplayError(ex); }; } ; BindList(); }
public void EditCharacter() { if (listBoxCharacterList.SelectedItem != null) { CharacterForm cf = new CharacterForm(); cf.Character = GetSelectedCharacter(); cf.ShowDialog(); RefreshList(); } }
private void OnCharacterNew(object sender, EventArgs e) { var form = new CharacterForm(); if (form.ShowDialog(this) == DialogResult.OK) { AddCharacter(form.Character); UpdateUI(); } }
private void OnCharacterAdd(object sender, EventArgs e) { var form = new CharacterForm(); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } database.Add(form.Character); RefreshCharacters(); }
private void OnCharacterAdd(object sender, EventArgs e) { var form = new CharacterForm(); var result = form.ShowDialog(this); if (result == DialogResult.Cancel) { return; } AddCharacter(null); }
private void OnCharacterNew(object sender, EventArgs e) { var form = new CharacterForm(); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _character = form.SelectedCharacter; AddCharacter(form.SelectedCharacter); }
private void OnCharacterAdd(object sender, EventArgs e) { var form = new CharacterForm(); var result = form.ShowDialog(this); if (result == DialogResult.Cancel) { return; } _character = form.Character; MessageBox.Show("Save successful"); }
public void NewCharacter() { CharacterForm characterForm = new CharacterForm(); characterForm.ShowDialog(this); Character newCharacter = characterForm.Character; if (newCharacter != null) { _charDB.Add(newCharacter); RefreshList(); } }
private void OnCharacterNew(object sender, EventArgs e) { //Creates an instance of Character Form var form = new CharacterForm(); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Add(form.Character); //Calls Add method in database to store the Character RefreshCharacters(); }
//Event Handler for adding a character private void OnCharacterAdd(object sender, EventArgs e) { var form = new CharacterForm(); if (form.ShowDialog(this) != DialogResult.OK) { return; } _characters[GetNextEmptyPosition()] = form.CurrentCharacter; BindList(); }
private void OnnewToolStripMenuItem_Click(object sender, EventArgs e) { var form = new CharacterForm(); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } Character Name = form.Characters; Database.Add(Name); RefreshCharacters(); }
private void OnCharacterNew(object sender, EventArgs e) { var form = new CharacterForm(); var result = form.ShowDialog(this); //Blocks until form is dismissed/ if (result == DialogResult.Cancel) { return; } _character = form.Character; MessageBox.Show("Save successful"); RefreshRoster(); }
private void OnCharacterNew(object sender, EventArgs e) { var form = new CharacterForm(); var result = form.ShowDialog(this); if (result == DialogResult.OK) { return; } //_characters = form.Character; AddCharacter(form.Character); MessageBox.Show("Save successful"); // RefreshRoster(); }
private void OnCharacterNew(object sender, EventArgs e) { // display UI var form = new CharacterForm(); while (true) { // add new character if (form.ShowDialog(this) != DialogResult.OK) { return; } _roster.Add(form.Character); break; } BindList(); }
/// <summary> /// Show window for updating an existing character /// </summary> private void editToolStripMenuItem_Click(object sender, EventArgs e) { if (charactersListBox.SelectedIndex == -1) { MessageBox.Show("Select a character in the list to update.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Show window to update character CharacterForm form = new CharacterForm(characters[charactersListBox.SelectedIndex]); if (form.ShowDialog() == DialogResult.Cancel) { return; } // Update the list charactersListBox.Items[charactersListBox.SelectedIndex] = form.ProcessedCharacter; }
private void onCharacterNew(object sender, EventArgs e) { var form = new CharacterForm("Create New Character"); //display error if character is not unique if (form.ShowDialog(this) == DialogResult.OK) { try { _characters.Add(form.Character); UpdateUI(); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }; } }
private void OnCharacterEdit(object sender, EventArgs e) { var item = GetSelectedCharacter(); if (item == null) { return; } var form = new CharacterForm(); form.Character = item; if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Edit(item.Name, form.Character); RefreshCharacters(); }
private void OnCharacterEdit(object sender, EventArgs e) { var character = GetSelectedCharacter(); if (character == null) { return; } var form = new CharacterForm(); form.Character = character; if (form.ShowDialog(this) == DialogResult.OK) { RemoveCharacter(character); AddCharacter(form.Character); UpdateUI(); } }
private void OnCharacterEdit(object sender, EventArgs e) { var character = GetSelectedCharacter(); if (character == null) { return; } var form = new CharacterForm(character, "Edit Character"); var result = form.ShowDialog(this); if (result == DialogResult.Cancel) { return; } EditCharacter(character.Id, form.Character); }
/// <summary> /// When the user edits a character /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCharacterEdit(object sender, EventArgs e) { var character = GetSelectedCharacter(); if (character == null) { return; } //Changes the name of the form to Edit Character and auto fills the fields with that character's information var form = new CharacterForm(); form.Text = "Edit Character"; form.Character = character; if (form.ShowDialog(this) == DialogResult.OK) { _characters.Update(character.Id, form.Character); UpdateUI(); } ; }
private void EditCharacter() { var item = GetSelectedCharacter(); if (item == null) { return; } var form = new CharacterForm(); form.Character = item; form.Text = "Edit Character"; if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Edit(item.Name, form.Character); RefreshCharacters(); }
private void OnCharacterEdit(object sender, EventArgs e) { var character = GetSelectedCharacter(); if (character == null) { return; } var form = new CharacterForm(); form.Character = character; form.Text = "Edit Character"; if (form.ShowDialog(this) == DialogResult.OK) { _characters.Update(character.Id, form.Character); UpdateUI(); } ; }
private void OnCharacterEdit(object sender, EventArgs e) { var character = GetSelectedCharacter(); if (character == null) { return; } var form = new CharacterForm(); form.SelectedCharacter = character; if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _character = form.SelectedCharacter; RefreshRoster(); }
private void OnCharacterEdit(object sender, EventArgs e) { if (_character == null) { return; } var form = new CharacterForm(_character, "Edit Character"); //form.Movie = _movie; var result = form.ShowDialog(this); //Blocks until form is dismissed if (result == DialogResult.Cancel) { return; } // TODO: Update movie _character = form.Character; MessageBox.Show("Save successful"); }
private void EditCharacter() { //Gets currently selected character, if any var item = GetSelectedCharacter(); if (item == null) { return; } var form = new CharacterForm(); form.Text = "Edit Character"; form.Character = item; // Populates Character Form with the Selected Character's Data if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Edit(item.Name, form.Character); RefreshCharacters(); }