예제 #1
0
 public void ResetSource()
 {
     if (source != null)
     {
         source.TracksAdded   -= HandleTracksAdded;
         source.TracksDeleted -= HandleTracksDeleted;
         source = null;
     }
     TrackView.SetModel(null);
     FilterView.SetModel(null);
 }
예제 #2
0
        public bool SetSource(ISource source)
        {
            if ((source as MusicLibrarySource) == null)
            {
                return(false);
            }
            if ((source as MusicLibrarySource) == this.source)
            {
                SelectAllTracks();
                return(true);
            }
            else
            {
                ResetSource();
            }

            this.source = (source as MusicLibrarySource);
            this.source.TrackModel.Selection.Clear(false);
            this.source.TracksAdded   += HandleTracksAdded;
            this.source.TracksDeleted += HandleTracksDeleted;

            foreach (IFilterListModel list_model in this.source.CurrentFilters)
            {
                list_model.Clear();  //clear selections, we need all albums!!
                if (list_model is FilterListModel <AlbumInfo> )
                {
                    external_filter = list_model as FilterListModel <AlbumInfo>;
                    break;
                }
            }

            main_view.SetModel(TrackModel);
            FilterView.SetModel(external_filter);

            return(true);
        }