Beispiel #1
0
        public void Delete(Playlist playlist)
        {
            if (IsEmpty || playlist.PlaylistIndex == -1)
            {
                return;
            }

            BackgroundCommunicator.SendRemovePlaylist(playlist);

            Playlist oldCurrentPlaylist = CurrentPlaylist;

            playlists.Remove(playlist);
            playlists = new List <Playlist>(playlists);

            SetPlaylistToCurrentPlaylist(oldCurrentPlaylist);

            if (isForeground)
            {
                ViewModel.Current.UpdatePlaylists();
                ViewModel.Current.UpdateCurrentPlaylistIndexAndRest();

                if (IsEmpty)
                {
                    CurrentSong.Current.Unset();
                    SaveLibray.Delete();
                    LibraryIO.SaveText(DateTime.Now.Ticks.ToString(), "LibraryDeletedDelete.txt");
                }
            }
        }
Beispiel #2
0
        public void Load(string xmlText)
        {
            SaveLibray sc = XmlConverter.Deserialize <SaveLibray>(xmlText);

            playlists            = sc.Playlists;
            currentPlaylistIndex = sc.CurrentPlaylistIndex;

            SetLoaded();
        }
Beispiel #3
0
        private async Task LoadNonStatic()
        {
            SaveLibray sc = await SaveLibray.Load();

            playlists = sc.Playlists;

            loaded = true;
            currentPlaylistIndex = sc.CurrentPlaylistIndex == -2 ? 0 : sc.CurrentPlaylistIndex;

            //if (IsEmpty)
            //{
            //    await SaveLibray.Delete();
            //    LibraryIO.SaveText(DateTime.Now.Ticks.ToString(), "LibraryDeletedLoad.txt");
            //}
        }
Beispiel #4
0
        public async Task SaveAsync()
        {
            SaveLibray sc = new SaveLibray(CurrentPlaylistIndex, playlists as List <Playlist>);

            await sc.Save();
        }
Beispiel #5
0
        public string GetXmlText()
        {
            SaveLibray sc = new SaveLibray(CurrentPlaylistIndex, playlists as List <Playlist>);

            return(XmlConverter.Serialize(sc));
        }