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; }
public TrackStateViewModel(Track track, AudioPlayerState state) : base(track) { State = state; }
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); }
public TrackViewModel(Track track) { Track = track; }