public void PlaylistCreate() { var library = Library.Load(); Playlist pl; try { pl = new Playlist(library, "TestPlaylist 1"); } catch { Assert.Fail(); } }
public void PlaylistSaveSingle() { var library = Library.Load(); Playlist pl = new Playlist(library, "TestPlaylist 1"); pl.Add(library.GetSongs()); try { pl.Save(); } catch { Assert.Fail(); } }
public void PlaylistSaveMany() { var library = Library.Load(); Playlist pl = new Playlist(library, "TestPlaylist 2"); for (int i = 0; i < 10; i++) pl.Add(library.GetSongs()); try { pl.Save(); } catch { Assert.Fail(); } }
private void playlistGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (renamingPlaylist == null) return; string currentName = e.FormattedValue.ToString(); string oldName = this.renamingPlaylist.Name; string oldPath = this.renamingPlaylist.Path; if (string.IsNullOrEmpty(currentName)) e.Cancel = true; else { foreach (PlaylistBase pl in playlists) { if (currentName.ToLower() == pl.Name.ToLower()) if (currentName.ToLower() != oldName.ToLower()) { e.Cancel = true; break; } } } // save change file name as well if (!e.Cancel) { if (currentName.ToLower() != oldName.ToLower()) { renamingPlaylist.Name = currentName; try { if (File.Exists(oldPath)) System.IO.File.Move(oldPath, renamingPlaylist.Path); } catch (Exception ex) { MessageBox.Show("Playlist rename exception: " + ex.Message); } } renamingPlaylist = null; } }
private void CreateNewPlaylist() { string name = GetNewPlaylistName(false); var newPlaylist = new Playlist(library, name); playlists.Add(newPlaylist); SetPlaylistGridView(); ChangeToPlaylist(newPlaylist); }
private void RenamePlaylist() { renamingPlaylist = GetPlaylist(playlistGridView.CurrentCell.Value.ToString()) as Playlist; playlistGridView.BeginEdit(true); }