private void deleteBtn_Click(object sender, System.EventArgs e) { if (conferencesTreeView.SelectedNode == null) { return; } StringBuilder str = new StringBuilder(); str.Append(Strings.AreYouSureYouWantToDelete); if (conferencesTreeView.SelectedNode.Tag is Conference) { Conference conf = (conferencesTreeView.SelectedNode.Tag as Conference); str.AppendFormat(Strings.DeleteConference, conf.Description); } else if (conferencesTreeView.SelectedNode.Tag is Participant) { Participant part = (conferencesTreeView.SelectedNode.Tag as Participant); str.AppendFormat(Strings.DeleteParticipant, part.Name); } else if (conferencesTreeView.SelectedNode.Tag is Stream) { Stream stream = (conferencesTreeView.SelectedNode.Tag as Stream); str.AppendFormat(Strings.DeleteStream, stream.Name); } else { str.AppendFormat(Strings.DeleteFolder, conferencesTreeView.SelectedNode.Text); } // Ask "are you sure?" DialogResult result = RtlAwareMessageBox.Show(this, str.ToString(), Strings.ConfirmDeleteTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); if (result != DialogResult.Yes) { return; } // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete node conferencesTreeView.DeleteNode(conferencesTreeView.SelectedNode); // Return to normal cursor Cursor.Current = Cursors.Default; }
private void deleteBtn_Click(object sender, System.EventArgs e) { if (conferencesTreeView.SelectedNode == null) { return; } StringBuilder str = new StringBuilder(); str.Append("Are you sure you want to delete the "); if (conferencesTreeView.SelectedNode.Tag is Conference) { Conference conf = (conferencesTreeView.SelectedNode.Tag as Conference); str.AppendFormat("conference \n\"{0}\" and all the content it contains?", conf.Description); } else if (conferencesTreeView.SelectedNode.Tag is Participant) { Participant part = (conferencesTreeView.SelectedNode.Tag as Participant); str.AppendFormat("participant \n\"{0}\" \" and all the content it contains?", part.Name); } else if (conferencesTreeView.SelectedNode.Tag is Stream) { Stream stream = (conferencesTreeView.SelectedNode.Tag as Stream); str.AppendFormat("stream \"{0}\"?", stream.Name); } else { str.AppendFormat("folder \n\"{0}\" and all the content it contains?", conferencesTreeView.SelectedNode.Text); } // Ask "are you sure?" DialogResult result = MessageBox.Show(str.ToString(), "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result != DialogResult.Yes) { return; } // Display wait cursor Cursor.Current = Cursors.WaitCursor; // Delete node conferencesTreeView.DeleteNode(conferencesTreeView.SelectedNode); // Return to normal cursor Cursor.Current = Cursors.Default; }