예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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();
        }
예제 #7
0
 public void EditCharacter()
 {
     if (listBoxCharacterList.SelectedItem != null)
     {
         CharacterForm cf = new CharacterForm();
         cf.Character = GetSelectedCharacter();
         cf.ShowDialog();
         RefreshList();
     }
 }
예제 #8
0
        private void OnCharacterNew(object sender, EventArgs e)
        {
            var form = new CharacterForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                AddCharacter(form.Character);
                UpdateUI();
            }
        }
예제 #9
0
        private void OnCharacterAdd(object sender, EventArgs e)
        {
            var form = new CharacterForm();

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }
            database.Add(form.Character);
            RefreshCharacters();
        }
예제 #10
0
        private void OnCharacterAdd(object sender, EventArgs e)
        {
            var form   = new CharacterForm();
            var result = form.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            AddCharacter(null);
        }
예제 #11
0
        private void OnCharacterNew(object sender, EventArgs e)
        {
            var form = new CharacterForm();

            if (form.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            _character = form.SelectedCharacter;
            AddCharacter(form.SelectedCharacter);
        }
예제 #12
0
        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");
        }
예제 #13
0
        public void NewCharacter()
        {
            CharacterForm characterForm = new CharacterForm();

            characterForm.ShowDialog(this);
            Character newCharacter = characterForm.Character;

            if (newCharacter != null)
            {
                _charDB.Add(newCharacter);
                RefreshList();
            }
        }
예제 #14
0
        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();
        }
예제 #15
0
        //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();
        }
예제 #16
0
        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();
        }
예제 #17
0
        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();
        }
예제 #18
0
        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();
        }
예제 #19
0
        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();
        }
예제 #20
0
        /// <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;
        }
예제 #21
0
        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);
                };
            }
        }
예제 #22
0
        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();
        }
예제 #23
0
        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();
            }
        }
예제 #24
0
        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);
        }
예제 #25
0
        /// <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();
            }
            ;
        }
예제 #26
0
        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();
        }
예제 #27
0
        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();
            }
            ;
        }
예제 #28
0
        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();
        }
예제 #29
0
        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");
        }
예제 #30
0
        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();
        }