/// <summary>
        /// Sets the source and the track model for the source contents
        /// </summary>
        /// <param name="source">
        /// A <see cref="ISource"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        public bool SetSource(ISource source)
        {
            DatabaseSource track_source = source as DatabaseSource;

            if (track_source == null)
            {
                return(false);
            }

            this.source = source;

            track_view.SetModel(track_source.TrackModel);

            return(true);
        }
Exemple #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);
        }
 public override void ResetSource()
 {
     base.source = null;
     track_view.SetModel(null);
     artist_view.SetModel(null);
 }