protected override void Dispose(bool disposing) { if (disposing) { } if (!IsInvalid) { if (_callbacks != null) { _callbacks.Dispose(); _callbacks = null; } try { lock (Spotify.Mutex) { Spotify.sp_playlist_release(Handle); } } catch { } finally { PlaylistTrackManager.RemoveAll(this); PlaylistManager.Remove(Handle); Handle = IntPtr.Zero; Debug.WriteLine("Playlist disposed"); } } base.Dispose(disposing); }
public override void Initialize() { _callbacks = new NativePlaylistCallbacks(this); _tracks = new Lazy <NativePlaylistTrackList>(() => new NativePlaylistTrackList( GetNumberOfTracks, GetTrackIndex, AddTrack, AddNewTrack, RemoveTrack, () => false, MoveTrack, MoveMultipleTracks)); lock (Spotify.Mutex) { Spotify.sp_playlist_add_ref(Handle); Spotify.sp_playlist_update_subscribers(Session.GetHandle(), Handle); } }
public override void Initialize() { _callbacks = new NativePlaylistCallbacks(this); _tracks = new Lazy<NativePlaylistTrackList>(() => new NativePlaylistTrackList( GetNumberOfTracks, GetTrackIndex, AddTrack, AddNewTrack, RemoveTrack, () => false, MoveTrack, MoveMultipleTracks)); lock (Spotify.Mutex) { Spotify.sp_playlist_add_ref(Handle); Spotify.sp_playlist_update_subscribers(Session.GetHandle(), Handle); } }