예제 #1
0
 public LibraryAlbumInfo(
     LibraryPlaybackTrack track,
     int thumbnailMaxWidth,
     int thumbnailMaxHeight)
     : this(track, thumbnailMaxWidth, thumbnailMaxHeight, null)
 {
 }
예제 #2
0
 public LibraryAlbumInfo(
     LibraryPlaybackTrack track,
     int thumbnailMaxWidth,
     int thumbnailMaxHeight,
     ICommand onAsyncUpdateAlbumArtUrlCompleted)
 {
     this._onAsyncUpdateAlbumArtUrlCompleted = onAsyncUpdateAlbumArtUrlCompleted == null ? new Command(this) : onAsyncUpdateAlbumArtUrlCompleted;
     if (track.MediaType == MediaType.Track)
     {
         this._trackId    = track.MediaId;
         this._trackTitle = track.Title;
         int[] columnIndexes1 = new int[2] {
             11, 78
         };
         object[] fieldValues1 = new object[2]
         {
             -1,
             -1
         };
         ZuneLibrary.GetFieldValues(this._trackId, EListType.eTrackList, columnIndexes1.Length, columnIndexes1, fieldValues1, PlaylistManager.Instance.QueryContext);
         int albumId  = (int)fieldValues1[0];
         int iMediaId = (int)fieldValues1[1];
         if (albumId >= 0)
         {
             int[] columnIndexes2 = new int[2] {
                 382, 451
             };
             object[] fieldValues2 = new object[2];
             ZuneLibrary.GetFieldValues(albumId, EListType.eAlbumList, columnIndexes2.Length, columnIndexes2, fieldValues2, PlaylistManager.Instance.QueryContext);
             this._albumTitle  = (string)fieldValues2[0];
             this._zuneMediaId = GuidHelper.CreateFromString((string)fieldValues2[1]);
             ThreadPool.QueueUserWorkItem(args =>
             {
                 string str = LibraryDataProviderItemBase.GetArtUrl(albumId, "Album", false);
                 if (!string.IsNullOrEmpty(str))
                 {
                     str = "file://" + str;
                 }
                 Application.DeferredInvoke(new DeferredInvokeHandler(this.AsyncUpdateAlbumArtUrl), str);
             }, null);
         }
         if (iMediaId < 0)
         {
             return;
         }
         int[] columnIndexes3 = new int[1] {
             138
         };
         object[] fieldValues3 = new object[1];
         ZuneLibrary.GetFieldValues(iMediaId, EListType.eArtistList, columnIndexes3.Length, columnIndexes3, fieldValues3, PlaylistManager.Instance.QueryContext);
         this._artistName = (string)fieldValues3[0];
     }
     else if (track.MediaType == MediaType.PodcastEpisode)
     {
         this._trackId    = track.MediaId;
         this._trackTitle = track.Title;
         int[] columnIndexes1 = new int[2] {
             311, 24
         };
         object[] fieldValues1 = new object[2]
         {
             -1,
             null
         };
         ZuneLibrary.GetFieldValues(this._trackId, EListType.ePodcastEpisodeList, columnIndexes1.Length, columnIndexes1, fieldValues1, PlaylistManager.Instance.QueryContext);
         int iMediaId = (int)fieldValues1[0];
         this._artistName = (string)fieldValues1[1];
         if (iMediaId < 0)
         {
             return;
         }
         int[] columnIndexes2 = new int[2] {
             344, 17
         };
         object[] fieldValues2 = new object[2];
         ZuneLibrary.GetFieldValues(iMediaId, EListType.ePodcastList, columnIndexes2.Length, columnIndexes2, fieldValues2, PlaylistManager.Instance.QueryContext);
         this._albumTitle  = (string)fieldValues2[0];
         this._albumArtUrl = (string)fieldValues2[1];
     }
     else
     {
         if (track.MediaType != MediaType.Video)
         {
             return;
         }
         this._trackId    = track.MediaId;
         this._trackTitle = track.Title;
         int[] columnIndexes = new int[3] {
             380, 382, 312
         };
         object[] fieldValues = new object[3];
         ZuneLibrary.GetFieldValues(this._trackId, EListType.eVideoList, columnIndexes.Length, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext);
         this._artistName = (string)fieldValues[0];
         this._albumTitle = (string)fieldValues[1];
         if (string.IsNullOrEmpty(this._albumTitle))
         {
             this._albumTitle = (string)fieldValues[2];
         }
         if (Application.RenderingType != RenderingType.GDI)
         {
             return;
         }
         ThreadPool.QueueUserWorkItem(args =>
         {
             string artUrl = LibraryDataProviderItemBase.GetArtUrl(this._trackId, "Video", false);
             if (string.IsNullOrEmpty(artUrl))
             {
                 return;
             }
             Application.DeferredInvoke(new DeferredInvokeHandler(this.AsyncUpdateThumbnailUrl), "file://" + artUrl);
         }, null);
     }
 }