Пример #1
0
        private void AddGame_FormClosing(object sender, FormClosingEventArgs e)
        {
            if ((!string.IsNullOrEmpty(nameTextBox.Text)) && (!Compl))
            {
                var SV = new SaveNotSaveDialog();
                switch (SV.ShowDialog())
                {
                case DialogResult.OK:
                    if (AddingGame.ID_Game > 0)
                    {
                        EditButton.PerformClick();
                    }
                    else
                    {
                        AddBut.PerformClick();
                    }
                    break;

                case DialogResult.No:
                    _context.RejectChanges(AddingGame);
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    break;
                }
            }
            else
            {
                _context.RejectChanges(AddingGame);
            }
        }