private void btnDeleteMBS_Click(object sender, System.EventArgs e) { FrmParent.PostActivity(); DialogResult DR = MessageBox.Show("Do you wish to permanently delete this Media Buffer Server?","Confirm permanent deletion",MessageBoxButtons.OKCancel); if(DR == DialogResult.OK) { OysterClassLibrary.MediaBufferServer M = (OysterClassLibrary.MediaBufferServer)lvMBS.SelectedItems[0].Tag; OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); F.DeleteMediaBufferServer(M.ID); F.Dispose(); Trace.WriteLine("Deleted MediaBufferServer: " + M.Address + ":" + M.Port.ToString() + "(" + M.ID + ")" ,System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name); lvMBS.Items.Clear(); FrmParent.LoginUser = FrmParent.OSystem.Refresh(); bool DidOnce = false; //Reset_All(); foreach(OysterClassLibrary.MediaBufferServer MBS in FrmParent.OSystem.MEDIABUFFERSERVERS) { if(UO[3] != MBS.ID) { ListViewItem LVI = lvMBS.Items.Add(MBS.Address); LVI.SubItems.Add(MBS.Port.ToString()); LVI.Tag = MBS; if(DidOnce == false) { DidOnce = true; LVI.Selected = true; lvMBS_SelectedIndexChanged(lvMBS,new EventArgs()); } } } } }