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();
        }
Пример #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.");
        }
Пример #3
0
        public MainForm()
        {
            InitializeComponent();

            CharacterForm character;

            character = new CharacterForm();

            _lstCharacters            = null;
            miCharacterAdd.Click     += OnCharacterAdd;
            miCharacterDelete.Click  += OnCharacterDelete;
            toolStripMenuItem7.Click += OnCharacterExit;
            miHelpAbout.Click        += OnHelpAbout;
            miCharacterEdit.Click    += OnCharacterEdit;
        }
Пример #4
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();
        }