Esempio n. 1
0
        public async static Task <bool> SaveNowPlaying()
        {
            while (true)
            {
                try
                {
                    if (PlaylistRepresentation.Count > 0)
                    {
                        string        nowplayingstring = SongListStorage.NowPlayingToString();
                        StorageFolder storageFolder    = Windows.Storage.ApplicationData.Current.LocalFolder;
                        StorageFile   nowplayingfile   = await storageFolder.CreateFileAsync("nowplaying.txt", Windows.Storage.CreationCollisionOption.OpenIfExists);

                        //storageFolder.
                        await FileIO.WriteTextAsync(nowplayingfile, nowplayingstring);

                        SavePlace();
                    }

                    return(true);
                }
                catch (FileLoadException E)
                {
                    Debug.WriteLine("Couldn't save now playing.");
                    Debug.WriteLine(E.Message);
                }
                catch (IOException E)
                {
                    Debug.WriteLine("Couldn't save now playing.");
                    Debug.WriteLine(E.Message);
                }
            }
        }