private void deleteButton_Click(object sender, EventArgs e) { if (libraryListBox.CheckedItems.Count > 0) { string prompt = "Are you sure you want to delete "; if (libraryListBox.CheckedItems.Count == 1) { prompt += libraryListBox.CheckedItems[0].ToString(); } else { prompt += libraryListBox.CheckedItems.Count + " items"; } prompt += "?"; if (MessageBox.Show(prompt, "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { for (int x = 0; x < libraryListBox.CheckedItems.Count; x++) { Library.removeFromLibrary((string)libraryListBox.CheckedItems[x]); File.Delete(EditableSlideSet.getNewPath((string)libraryListBox.CheckedItems[x])); } updateLibraryList(); } } }
private void exportButton_Click(object sender, EventArgs e) { if (libraryListBox.CheckedIndices.Count != 0) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { string[] files = new string[libraryListBox.CheckedItems.Count]; for (int x = 0; x < libraryListBox.CheckedItems.Count; x++) { files[x] = EditableSlideSet.getNewPath((string)libraryListBox.CheckedItems[x]); } Library.ExportLibrary(saveFileDialog.FileName, files); updateLibraryList(); } } else { MessageBox.Show("You must select at least one song to export.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }