private void OnNewChacter(object sender, EventArgs e)
        {
            var form = new CharacterForm();

            if (form.ShowDialog(this) == DialogResult.Cancel)//'this' makes the main window the parent of the new form
            {
                return;
            }

            //add to database and refresh
            _database.Add(form.Character);
            RefreshScreen();
        }
Ejemplo n.º 2
0
        private void OnCharacterAdd(object sender, EventArgs e)
        {
            var form = new CharacterForm();

            var result = form.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            // SAVE MOVIE
            MessageBox.Show("Character Data Successfully Saved.");
        }
Ejemplo n.º 3
0
        private void OnCharacterEdit(object sender, EventArgs e)
        {
            if (_character == null)
            {
                return;
            }

            var form = new CharacterForm(_character, "Edit Character");

            var result = form.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            _character = form.Character;

            MessageBox.Show("Save Successful");
        }
        private void OnCharacterEdit(object sender, EventArgs e)
        {
            var item = GetSelectedCharacter();

            if (item == null)
            {
                return;
            }

            //Show form with selected movie
            var form = new CharacterForm();

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

            //Update database and refresh
            _database.Edit(item.Name, form.Character);
            RefreshScreen();
        }