public void AddPlaylist(Model.Playlist newPlaylist) { if (Playlists.Any(cus => cus.Name == newPlaylist.Name) == false) { XML.PlaylistXML playlistXML = new XML.PlaylistXML(); playlistXML.Load("playlists.xml"); if (!playlistXML.HasPlaylist(newPlaylist.Name)) { playlistXML.AddPlaylist(newPlaylist.Name); playlistXML.WriteInFile("playlists.xml"); Playlists.Add(newPlaylist); } } }
public void DeletePlaylistItem(Model.Media media) { if (CurrentPlaylist != null && media != null) { XML.PlaylistXML playlistXML = new XML.PlaylistXML(); playlistXML.Load("playlists.xml"); if (playlistXML.HasMedia(CurrentPlaylist.Name, media)) { playlistXML.RemovePlaylistItem(CurrentPlaylist.Name, media); playlistXML.WriteInFile("playlists.xml"); CurrentPlaylist.Medias.Remove(media); } } }
public void RemovePlaylist(Model.Playlist selectedPlaylist) { if (Playlists.Any(cus => cus.Name == selectedPlaylist.Name) == true) { XML.PlaylistXML playlistXML = new XML.PlaylistXML(); playlistXML.Load("playlists.xml"); if (playlistXML.HasPlaylist(selectedPlaylist.Name)) { playlistXML.RemovePlaylist(selectedPlaylist.Name); playlistXML.WriteInFile("playlists.xml"); Playlists.Remove(selectedPlaylist); } } }