예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }