private IContainerPlaylist GetPlaylistAtIndex(int index) { lock (Spotify.Mutex) { return(ContainerPlaylistManager.Get( Session, this, Spotify.sp_playlistcontainer_playlist(Handle, index), Spotify.sp_playlistcontainer_playlist_folder_id(Handle, index), Spotify.sp_playlistcontainer_playlist_type(Handle, index))); } }
private IContainerPlaylist AddNewPlaylist(string name) { AssertHandle(); lock (Spotify.Mutex) { IntPtr playlistPtr = Spotify.sp_playlistcontainer_add_new_playlist(Handle, name); return(ContainerPlaylistManager.Get( Session, this, playlistPtr, IntPtr.Zero, PlaylistType.Playlist)); } }
private void OnPlaylistAddedCallback(IntPtr containerPointer, IntPtr playlistptr, int position, IntPtr userdataptr) { if (containerPointer != _container.Handle) { return; } var containerPlaylist = ContainerPlaylistManager.Get( _container.Session, _container, playlistptr, Spotify.sp_playlistcontainer_playlist_folder_id(containerPointer, position), Spotify.sp_playlistcontainer_playlist_type(containerPointer, position)); var args = new PlaylistEventArgs(containerPlaylist, position); _container.QueueThis(() => _container.OnPlaylistAdded(args)); }
private IContainerPlaylist AddExistingPlaylist(ILink <IPlaylist> link) { INativeObject nativeObject = (INativeObject)link; AssertHandle(); lock (Spotify.Mutex) { IntPtr playlistPtr = Spotify.sp_playlistcontainer_add_playlist(Handle, nativeObject.Handle); return(ContainerPlaylistManager.Get( Session, this, playlistPtr, IntPtr.Zero, PlaylistType.Playlist)); } }
private void OnPlaylistMovedCallback(IntPtr containerPointer, IntPtr playlistptr, int position, int newposition, IntPtr userdataptr) { if (containerPointer != _container.Handle) { return; } // HACK : The indices are wrong when moving playlists up if (position < newposition) { newposition--; } var containerPlaylist = ContainerPlaylistManager.Get( _container.Session, _container, playlistptr, Spotify.sp_playlistcontainer_playlist_folder_id(containerPointer, position), Spotify.sp_playlistcontainer_playlist_type(containerPointer, position)); var args = new PlaylistMovedEventArgs(containerPlaylist, position, newposition); _container.QueueThis(() => _container.OnPlaylistMoved(args)); }