示例#1
0
        public TrackAlbumAssociationViewModel(
            TrackAlbumAssociation trackAlbumAssociation)
        {
            this._trackAlbumAssociation = trackAlbumAssociation ?? throw new ArgumentNullException(nameof(trackAlbumAssociation));

            if (this._trackAlbumAssociation.Album != null)
            {
                this.AlbumViewModel = new AlbumViewModel(this._trackAlbumAssociation.Album);
            }
        }
        public EditTrackAlbumAssociationViewModel(
            TrackAlbumAssociation trackAlbumAssociation)
        {
            this._trackAlbumAssociation = trackAlbumAssociation ?? throw new ArgumentNullException(nameof(trackAlbumAssociation));

            this.TrackNumber = this._trackAlbumAssociation.TrackNumber;
            this.DiscNumber  = this._trackAlbumAssociation.DiscNumber;

            this._albumViewModels = new ObservableCollection <AlbumViewModel>();
            this.AlbumViewModels  = new ReadOnlyObservableCollection <AlbumViewModel>(this._albumViewModels);
        }
        public Track ToTrack(uint trackId)
        {
            Track track = null;

            try
            {
                TrackAlbumAssociation trackAlbumAssociation = null;

                try
                {
                    trackAlbumAssociation = new TrackAlbumAssociation(
                        new Album(
                            this.Album,
                            this.AlbumArtistNames,
                            this.TrackCount,
                            this.DiscCount),
                        this.TrackNumber,
                        this.DiscNumber);
                }
                catch// (Exception ex)
                {
                    trackAlbumAssociation = null;
                }

                track = new Track(
                    trackId,
                    // library entry
                    new Uri(this.Location),
                    this.TotalTime,
                    this.DateModified,
                    this.Size,
                    // track
                    this.Name,
                    this.ArtistNames,
                    this.ComposerNames,
                    this.Year,
                    trackAlbumAssociation,
                    this.Loved,
                    this.DateAdded);
            }
            catch //(Exception ex)
            {
                track = null;
            }

            return(track);
        }
 public AddTrackCommand(
     // LibraryEntry
     Uri location,
     TimeSpan?duration,
     DateTime?lastModified,
     uint?fileSizeBytes,
     // Track
     string title,
     IEnumerable <string> performers,
     IEnumerable <string> composers,
     uint?year,
     TrackAlbumAssociation albumAssociation)
     : base(location, duration, lastModified, fileSizeBytes)
 {
     this.Title            = title;
     this.Performers       = performers.ToImmutableArray();
     this.Composers        = composers.ToImmutableArray();
     this.Year             = year;
     this.AlbumAssociation = albumAssociation;
 }
示例#5
0
        public async Task <Track> CreateAsync(
            Uri location,
            TimeSpan?duration,
            DateTime?lastModified,
            uint?fileSizeBytes,
            string title,
            IEnumerable <string> performers,
            IEnumerable <string> composers,
            uint?year,
            TrackAlbumAssociation albumAssociation)
        {
            Track newTrack;

            try
            {
                newTrack = new Track(
                    await this._serializer.GetNewIdentity(),
                    location,
                    duration,
                    lastModified,
                    fileSizeBytes,
                    title,
                    performers,
                    composers,
                    year,
                    albumAssociation,
                    false,
                    DateTime.Now);
            }
            catch //(Exception ex)
            {
                // TODO: log
                newTrack = null;
            }

            return(newTrack);
        }
 public Task <Track> CreateAsync(Uri location, TimeSpan?duration, DateTime?lastModified, uint?fileSizeBytes, string title, IEnumerable <string> performers, IEnumerable <string> composers, uint?year, TrackAlbumAssociation albumAssociation)
 {
     throw new NotSupportedException();
 }
 public Track CreateTracksAsync(Uri location, TimeSpan?duration, DateTime?lastModified, uint?fileSizeBytes, DateTime addedToLibraryDateTime, bool isLoved, string title, IEnumerable <Artist> performers, IEnumerable <Artist> composers, uint?year, TrackAlbumAssociation albumAssociation)
 {
     throw new NotImplementedException();
 }