public async Task RemovePlaylist(Playlist playlist) { PlaylistDataMember.Remove(playlist); Playlists.Remove(playlist); await PlaylistManager.Instance.Serialize(); }
public static void GetNowPlayingIndices(out int previousIndex, out int currentIndex, out int nextIndex, out int subsequentIndex, Playlist playlist = null) { currentIndex = NowPlayingInformation.CurrentIndex; if (playlist == null) { playlist = NowPlayingInformation.CurrentPlaylist; } if (playlist == null) { previousIndex = currentIndex = nextIndex = subsequentIndex = -1; return; } previousIndex = currentIndex - 1; if (previousIndex < 0) { if (RepeatEnabled) { previousIndex += playlist.Songs.Count; } else { previousIndex = -1; } } nextIndex = currentIndex + 1; if (nextIndex >= playlist.Songs.Count) { if (RepeatEnabled) { nextIndex -= playlist.Songs.Count; } else { nextIndex = -1; } } subsequentIndex = currentIndex + 2; if (subsequentIndex >= playlist.Songs.Count) { if (RepeatEnabled) { subsequentIndex -= playlist.Songs.Count; } else { subsequentIndex = -1; } } }
public async Task AddPlaylist(Playlist playlist) { PlaylistDataMember.Add(playlist); Playlists.Add(playlist); await PlaylistManager.Instance.Serialize(); }