private void btnDeleteVSS_Click(object sender, System.EventArgs e) { FrmParent.PostActivity(); DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Video Storage Server?","Confirm permanent deletion",MessageBoxButtons.OKCancel); if(DR == DialogResult.OK) { OysterClassLibrary.VideoStorageServer V = (OysterClassLibrary.VideoStorageServer)lvVSS.SelectedItems[0].Tag; OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); F.DeleteVideoStorageServer(V.ID); F.Dispose(); Trace.WriteLine("Deleted VideoStorageServer: " + V.ControlAddress +":" + V.ControlPort.ToString() + "(" + V.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); } bool DidOnce = false; FrmParent.LoginUser = FrmParent.OSystem.Refresh(); lvVSS.Items.Clear(); //Reset_All(); foreach(OysterClassLibrary.VideoStorageServer V in FrmParent.OSystem.VIDEOSTORAGESERVERS) { if(UO[4] != V.ID) { ListViewItem LVI = lvVSS.Items.Add(V.ControlAddress); LVI.SubItems.Add(V.ControlPort.ToString()); LVI.Tag = V; if(DidOnce == false) { DidOnce = true; LVI.Selected = true; lvVSS_SelectedIndexChanged(lvVSS,new EventArgs()); } } } }