public override void DeleteTracks(DatabaseTrackListModel model, Selection selection) { if (model == null || model.Count < 1) { return; } var list = CachedList <DatabaseTrackInfo> .CreateFromModelAndSelection(model, selection); ThreadAssist.SpawnFromMain(delegate { DeleteTrackList(list); }); }
protected void LoadTrackModel(TrackListModel model, Selection selection) { DatabaseTrackListModel db_model = model as DatabaseTrackListModel; if (db_model != null) { db_selection = CachedList <DatabaseTrackInfo> .CreateFromModelAndSelection(db_model, selection); } else { memory_selection = new List <TrackInfo> (); var items = new ModelSelection <TrackInfo> (model, selection); foreach (TrackInfo track in items) { memory_selection.Add(track); } } }
public override bool AddSelectedTracks(Source source, Selection selection) { if (!AcceptsInputFromSource(source)) { return(false); } DatabaseTrackListModel model = (source as ITrackModelSource).TrackModel as DatabaseTrackListModel; // Store a snapshot of the current selection CachedList <DatabaseTrackInfo> cached_list = CachedList <DatabaseTrackInfo> .CreateFromModelAndSelection(model, selection); if (ThreadAssist.InMainThread) { System.Threading.ThreadPool.QueueUserWorkItem(AddTrackList, cached_list); } else { AddTrackList(cached_list); } return(true); }