Esempio n. 1
0
        private void OnGameDelete(object sender, EventArgs e)
        {
            //Get selected game, if any
            var selected = GetSelectedGame();

            if (selected == null)
            {
                return;
            }

            //Display confirmation
            if (MessageBox.Show(this, $"Are you sure you want to delete {selected.Name}?",
                                "Confirm Delete", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            try
            {
                //DeleteGame(selected);
                _games.Delete(selected.Id);
            } catch (Exception ex)
            {
                DisplayError(ex);
            };
            BindList();
        }