Exemplo n.º 1
0
        public override void Initialize()
        {
            _browseComplete = new Spotify.ToplistBrowseCompleteCallback(OnBrowseCompleteCallback);
            _tracks         = new DelegateArray <ITrack>(GetNumberOfTracks, GetTrackAtIndex);
            _albums         = new DelegateArray <IAlbum>(GetNumberOfAlbums, GetAlbumAtIndex);
            _artists        = new DelegateArray <IArtist>(GetNumberOfArtists, GetArtistAtIndex);

            if (_userData != null)
            {
                _userDataHandle = GCHandle.Alloc(_userData);
            }

            lock (Spotify.Mutex)
            {
                Handle = Spotify.sp_toplistbrowse_create(
                    Session.GetHandle(),
                    _toplistType,
                    _region,
                    _userName,
                    _browseComplete,
                    _userDataHandle.IsAllocated ? GCHandle.ToIntPtr(_userDataHandle) : IntPtr.Zero);
            }
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            _browseComplete = new Spotify.ToplistBrowseCompleteCallback(OnBrowseCompleteCallback);
            _tracks = new DelegateArray<ITrack>(GetNumberOfTracks, GetTrackAtIndex);
            _albums = new DelegateArray<IAlbum>(GetNumberOfAlbums, GetAlbumAtIndex);
            _artists = new DelegateArray<IArtist>(GetNumberOfArtists, GetArtistAtIndex);

            if (_userData != null)
            {
                _userDataHandle = GCHandle.Alloc(_userData);
            }

            lock (Spotify.Mutex)
            {
                Handle = Spotify.sp_toplistbrowse_create(
                            Session.GetHandle(),
                            _toplistType,
                            _region,
                            _userName,
                            _browseComplete,
                            _userDataHandle.IsAllocated ? GCHandle.ToIntPtr(_userDataHandle) : IntPtr.Zero);
            }
        }