ATMLCommonLibrary.controls.lists.SpecificationListControl.btnDelete_Click C# (CSharp) Method

btnDelete_Click() protected method

protected btnDelete_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        protected override void btnDelete_Click(object sender, EventArgs e)
        {
            if (lvList.SelectedItems.Count > 0)
            {
                String prompt = MessageManager.getMessage("Generic.delete.prompt");
                String title = MessageManager.getMessage("Generic.title.verification");

                ListViewItem lvi = lvList.SelectedItems[0];
                object specificationItem = lvi.Tag;
                prompt = specificationItem is SpecificationGroup ? String.Format(prompt, "Specification Group", ((SpecificationGroup)specificationItem).name ):
                         specificationItem is Specification ? String.Format(prompt, "Specification", ((Specification)specificationItem).name ) : "";
                if (DialogResult.Yes == MessageBox.Show(prompt,
                                                        title,
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Question))
                {
                    lvi.Remove();
                }

            }
        }