ATMLCommonLibrary.controls.connector.ConnectorLocationPinListControl.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)
            {
                var location = (ConnectorLocation) lvList.SelectedItems[0].Tag;
                if (DialogResult.Yes ==
                    MessageBox.Show(
                        String.Format("Are you sure you want to delete Port Location Pin \"{0}-{1}\"?",
                            location.connectorID, location.pinID),
                        "Delete Port Location Pin",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question))
                {
                    lvList.Items.Remove(lvList.SelectedItems[0]);
                    _connectorLocations.Remove(location);
                }
            }
        }