Ejemplo n.º 1
0
 public static TopListBrowse Create(SpotifySession session, TopListType type, TopListRegion region, string username, TopListBrowseComplete callback, object userdata)
 {
     using (var utf8_username = SpotifyMarshalling.StringToUtf8(username))
     {
         IntPtr        listenerToken = ListenerTable.PutUniqueObject(callback, userdata);
         IntPtr        ptr           = NativeMethods.sp_toplistbrowse_create(session._handle, type, region, utf8_username.IntPtr, TopListBrowseCompleteDelegate, listenerToken);
         TopListBrowse browse        = BrowseTable.GetUniqueObject(ptr);
         browse.ListenerToken = listenerToken;
         return(browse);
     }
 }
Ejemplo n.º 2
0
 void GotTopList(TopListBrowse aResult, object aUserdata)
 {
     for (int i = 0; i != aResult.NumArtists(); ++i)
     {
         PrintArtist(i + 1, aResult.Artist(i));
     }
     for (int i = 0; i != aResult.NumAlbums(); ++i)
     {
         PrintAlbum(i + 1, aResult.Album(i));
     }
     for (int i = 0; i != aResult.NumTracks(); ++i)
     {
         Console.Write("{0,3}: ", i + 1);
         Printing.PrintTrack(iSession, aResult.Track(i));
     }
     aResult.Dispose();
     iConsoleReader.RequestInput("> ");
 }