protected override void Dispose(bool disposing)
        {
            // Dispose managed
            if (disposing)
            {
            }

            if (!IsInvalid)
            {
                if (_callbacks != null)
                {
                    _callbacks.Dispose();
                    _callbacks = null;
                }

                try
                {
                    lock (Spotify.Mutex)
                    {
                        Spotify.sp_playlistcontainer_release(Handle);
                    }
                }
                catch
                {
                }
                finally
                {
                    PlaylistContainerManager.Remove(Handle);
                    Debug.WriteLine("Playlist container disposed");
                }
            }

            base.Dispose(disposing);
        }
        public override void Initialize()
        {
            lock (Spotify.Mutex)
            {
                Spotify.sp_playlistcontainer_add_ref(Handle);
            }

            _callbacks = new NativePlaylistContainerCallbacks(this);
            _playlists = new Lazy <NativePlaylistList>(() => new NativePlaylistList(
                                                           GetContainerLength,
                                                           GetPlaylistAtIndex,
                                                           AddNewPlaylist,
                                                           AddExistingPlaylist,
                                                           AddFolder,
                                                           AddPlaylist,
                                                           RemovePlaylist,
                                                           RemovePlaylistAt,
                                                           () => false,
                                                           MovePlaylists));
        }
Esempio n. 3
0
        public override void Initialize()
        {
            lock (Spotify.Mutex)
            {
                Spotify.sp_playlistcontainer_add_ref(Handle);
            }

            _callbacks = new NativePlaylistContainerCallbacks(this);
            _playlists = new Lazy<NativePlaylistList>(() => new NativePlaylistList(
                GetContainerLength,
                GetPlaylistAtIndex,
                AddNewPlaylist,
                AddExistingPlaylist,
                AddFolder,
                AddPlaylist,
                RemovePlaylist,
                RemovePlaylistAt,
                () => false,
                MovePlaylists));
        }
Esempio n. 4
0
        protected override void Dispose(bool disposing)
        {
            // Dispose managed
            if (disposing)
            {
            }

            if (!IsInvalid)
            {
                if (_callbacks != null)
                {
                    _callbacks.Dispose();
                    _callbacks = null;
                }

                try
                {
                    lock (Spotify.Mutex)
                    {
                        Spotify.sp_playlistcontainer_release(Handle);
                    }
                }
                catch
                {
                }
                finally
                {
                    PlaylistContainerManager.Remove(Handle);
                    Debug.WriteLine("Playlist container disposed");
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 5
0
 internal static extern void sp_playlistcontainer_add_callbacks(IntPtr pcPtr, ref NativePlaylistContainerCallbacks.PlaylistContainerCallbacks callbacksPtr, IntPtr userdataPtr);
 internal static extern Error sp_playlistcontainer_remove_callbacks(IntPtr pcPtr, ref NativePlaylistContainerCallbacks.PlaylistContainerCallbacks callbacksPtr, IntPtr userdataPtr);