public void DeleteAllTracks(AbstractPlaylistSource source) { if (source.PrimarySource != this) { Log.WarningFormat("Cannot delete all tracks from {0} via primary source {1}", source, this); return; } if (source.Count < 1) { return; } ThreadAssist.SpawnFromMain(delegate { CachedList <DatabaseTrackInfo> list = CachedList <DatabaseTrackInfo> .CreateFromModel(source.DatabaseTrackModel); DeleteTrackList(list); }); }
public override bool AddAllTracks(Source source) { if (!AcceptsInputFromSource(source) || source.Count == 0) { return(false); } DatabaseTrackListModel model = (source as ITrackModelSource).TrackModel as DatabaseTrackListModel; CachedList <DatabaseTrackInfo> cached_list = CachedList <DatabaseTrackInfo> .CreateFromModel(model); if (ThreadAssist.InMainThread) { System.Threading.ThreadPool.QueueUserWorkItem(AddTrackList, cached_list); } else { AddTrackList(cached_list); } return(true); }