예제 #1
0
        public Track AddTrack(RawTrack track)
        {
            if (track == null)
                throw new ArgumentNullException("track");

            if (_trackDict.ContainsKey(track.FullFilename))
                throw new ArgumentException(track.FullFilename + " is already in library - use Update instead.", "track");

            Artist artist = _artists[track.ArtistName] ?? CreateArtist(track.ArtistName);
            Album album = _albums[track.AlbumTitle] ?? CreateAlbum(track.AlbumTitle, track.Year);

            var t = new Track(track, album, artist);
            _tracks.Add(t);
            album.Tracks.Add(t);

            _trackDict.Add(track.FullFilename, t);

            return t;
        }
예제 #2
0
 public TrackStateViewModel(Track track, AudioPlayerState state) : base(track)
 {
     State = state;
 }
예제 #3
0
        public void RemoveTrack(Track track)
        {
            Album album = track.Album;
            Artist artist = track.Artist;

            _tracks.Remove(track);
            if (album != null)
            {
                album.Tracks.Remove(track);
                if (album.Tracks.Count == 0)
                    _albums.Remove(album);
            }

            if (artist != null)
            {
                if (artist.Albums.Count == 0)
                    _artists.Remove(artist);
            }

            _trackDict.Remove(track.FilePath);
        }
예제 #4
0
 public TrackViewModel(Track track)
 {
     Track = track;
 }