protected override void Dispose(bool disposing) { if (disposing) { // Dispose managed } if (!IsInvalid) { // Dispose unmanaged try { if (_callbacks != null) { _callbacks.Dispose(); _callbacks = null; } lock (Spotify.Mutex) { Ensure(() => Spotify.sp_search_release(Handle)); } } catch { } } base.Dispose(disposing); }
public override void Initialize() { _callbacks = new NativeSearchCallbacks(this, _userData); _tracksLazyLoad = new Lazy <DelegateArray <ITrack> >(() => new DelegateArray <ITrack>(GetNumberOfTracks, GetTrackIndex)); _albumsLazyLoad = new Lazy <DelegateArray <IAlbum> >(() => new DelegateArray <IAlbum>(GetNumberOfAlbums, GetAlbumIndex)); _artistsLazyLoad = new Lazy <DelegateArray <IArtist> >(() => new DelegateArray <IArtist>(GetNumberOfArtists, GetArtistIndex)); _playlistsLazyLoad = new Lazy <DelegateArray <IPlaylistSearchResult> >(() => new DelegateArray <IPlaylistSearchResult>(GetNumberOfPlaylists, GetPlaylistAtIndex)); lock (Spotify.Mutex) { Handle = Spotify.sp_search_create( Session.GetHandle(), _query, _trackOffset, _trackCount, _albumOffset, _albumCount, _artistOffset, _artistCount, _playlistOffset, _playlistCount, _searchType, _callbacks.CallbackHandle, _callbacks.UserDataHandle); } }
public override void Initialize() { Callbacks = new NativeSearchCallbacks(this, _userData); TracksLazyLoad = new Lazy<DelegateArray<ITrack>>(() => new DelegateArray<ITrack>(GetNumberOfTracks, GetTrackIndex)); AlbumsLazyLoad = new Lazy<DelegateArray<IAlbum>>(() => new DelegateArray<IAlbum>(GetNumberOfAlbums, GetAlbumIndex)); ArtistsLazyLoad = new Lazy<DelegateArray<IArtist>>(() => new DelegateArray<IArtist>(GetNumberOfArtists, GetArtistIndex)); lock (Spotify.Mutex) { Handle = Spotify.sp_radio_search_create( Session.GetHandle(), (uint)_fromYear, (uint)_toYear, _genre, Callbacks.CallbackHandle, Callbacks.UserDataHandle); Spotify.sp_search_add_ref(Handle); } }
protected override void Dispose(bool disposing) { if (disposing) { // Dispose managed } if (!IsInvalid) { // Dispose unmanaged try { if (_callbacks != null) { _callbacks.Dispose(); _callbacks = null; } lock (Spotify.Mutex) { Spotify.sp_search_release(Handle); Handle = IntPtr.Zero; } } catch { } } base.Dispose(disposing); }
public override void Initialize() { _callbacks = new NativeSearchCallbacks(this, _userData); _tracksLazyLoad = new Lazy<DelegateArray<ITrack>>(() => new DelegateArray<ITrack>(GetNumberOfTracks, GetTrackIndex)); _albumsLazyLoad = new Lazy<DelegateArray<IAlbum>>(() => new DelegateArray<IAlbum>(GetNumberOfAlbums, GetAlbumIndex)); _artistsLazyLoad = new Lazy<DelegateArray<IArtist>>(() => new DelegateArray<IArtist>(GetNumberOfArtists, GetArtistIndex)); lock (Spotify.Mutex) { Handle = Spotify.sp_search_create( Session.GetHandle(), _query, _trackOffset, _trackCount, _albumOffset, _albumCount, _artistOffset, _artistCount, _callbacks.CallbackHandle, _callbacks.UserDataHandle); } }