private void addFileToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openSongs = new OpenFileDialog(); openSongs.Multiselect = true; openSongs.Filter = "*.mp3|*.mp3"; if (openSongs.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in openSongs.FileNames) { Library.insert(file); if (playlistSelected) { Playlist.addToPlalist(Playlist.getPlaylistID(treeView1.SelectedNode.Text), Library.getSongID(file)); } if (playlistView) { Playlist.addToPlalist(Playlist.getPlaylistID(playlistName), Library.getSongID(file)); } } reloadList(); } }
void item_Click(object sender, EventArgs e) { foreach (ListViewItem item in songLibrary.SelectedItems) { Playlist.addToPlalist(sender.ToString(), Library.getSongID(item.Tag.ToString())); } }
private void listView1_DragDrop(object sender, DragEventArgs e) { string[] files; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { files = (string[])(e.Data.GetData(DataFormats.FileDrop)); } else if (e.Data.GetDataPresent(typeof(string[]))) { files = (string[])(e.Data.GetData(typeof(string[]))); } else { return; } foreach (string file in files) { if (File.Exists(file) && file.EndsWith(".mp3")) { Library.insert(file); if (playlistSelected) { Playlist.addToPlalist(treeView1.SelectedNode.Text, Library.getSongID(file)); } else if (playlistView) { Playlist.addToPlalist(playlistName, Library.getSongID(file)); } } } reloadList(); }