Example #1
0
        private void ButtonDelete_Click(object sender, EventArgs e)
        {
            ListViewItem selectedItem = listViewAliases.SelectedItems[0];
            string       text         = selectedItem.SubItems[0].Text;

            string[] oldAlias = text.Split(' ');

            DialogResult confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                                         "Confirm Delete!!", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)

            {
                var dataBase = new SqliteDatabase(labelDB.Text);
                dataBase.DeleteAlias(oldAlias[0]);
                aliasDictionary.Remove(oldAlias[0]);
                RefreshAlias();
            }
            else
            {
                return;
            }

            buttonChange.Enabled = false;
            buttonDelete.Enabled = false;

            labelAliasInfo.Text = "Alias  " + text + " was deleted ";
        }