示例#1
0
        public override bool Equals(object obj)
        {
            PlayerTrack track2 = (PlayerTrack)obj;

            return(TrackID == track2.TrackID &&
                   Duration == track2.Duration &&
                   TrackName == track2.TrackName &&
                   Artists == track2.Artists &&
                   Album == track2.Album);
        }
示例#2
0
        //***********************************************************************************************************************************************************************************************************

        /// <summary>
        /// Convert a Spotify Web API FullTrack to a generic PlayerTrack
        /// </summary>
        /// <param name="track">Spotify Web API FullTrack</param>
        /// <returns>Generic PlayerTrack</returns>
        private PlayerTrack convertSpotifyTrackToPlayerTrack(FullTrack track)
        {
            if (track == null)
            {
                return(null);
            }

            PlayerTrack pTrack = new PlayerTrack()
            {
                TrackID   = track.Id,
                Duration  = new TimeSpan(0, 0, 0, 0, track.DurationMs),
                TrackName = track.Name,
                Artists   = track.Artists.Select(a => new PlayerArtist(a.Name, a.Id)).ToList(),
                Album     = new PlayerAlbum(track.Album.Name, track.Album.Id, track.Album.ReleaseDate, track.Album.Images.Select(i => getBitmapFromUrl(i.Url)).ToList())
            };

            return(pTrack);
        }