Exemple #1
0
        private void OnCharacterEdit_Click(object sender, EventArgs e)
        {
            var form = new CreateNewCharacter();

            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();
        }
Exemple #2
0
        private void OnCharacterNew(object sender, EventArgs e)
        {
            var form = new CreateNewCharacter();

            var result = form.ShowDialog(this);

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

            AddCharacter(form.Character);
        }
        private void OnCharacterNew(object sender, EventArgs e)
        {
            var form = new CreateNewCharacter();

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

            _database.Add(form.Character);

            RefreshCharacters();
        }
Exemple #4
0
        private void OnCharacterNew_Click(object sender, EventArgs e)
        {
            var form = new CreateNewCharacter();

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

            _characters.Add(form.Character);

            BindList();
        }
Exemple #5
0
        private void OnCharacterNew(object sender, EventArgs e)
        {
            var form = new CreateNewCharacter();

            form.ShowDialog();
            //// ShowDialog - modal ::= user must interact with child form, cannot access parent
            //// Show - modeless ::= multiple window open and accessible at same time
            //var result = form.ShowDialog(this);  //Blocks until form is dismissed
            //if (result == DialogResult.Cancel)
            //    return;

            ////After form is gone
            ////TODO: Save movie
            //_movie = form.Movie;

            //MessageBox.Show("Save successful");
        }
Exemple #6
0
        private void OnCharacterEdit(object sender, EventArgs e)
        {
            var character = GetSelectedCharacter();

            if (character == null)
            {
                return;
            }
            var form = new CreateNewCharacter(character, "Edit Character");

            var result = form.ShowDialog(this);

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

            EditCharacter(character.Id, form.Character);
        }
        private void EditCharacter()
        {
            var item = GetSelectedCharacter();

            if (item == null)
            {
                return;
            }

            var form = new CreateNewCharacter();

            form.Text = "Edit Character";

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

            _database.Edit(item.Name, form.Character);
            RefreshCharacters();
        }