Exemple #1
0
        private async void CheckPodcasts(BackgroundTaskDeferral deferral)
        {
            try
            {
                await Library.DeserializeAsync(false);

                if (Library.Podcasts.Count > 0)
                {
                    var index = LocalSettings.Instance.CurrentRefreshedIndex;

                    if (index >= Library.Podcasts.Count)
                    {
                        index = 0;
                    }

                    var podcast = Library.Podcasts[index];
                    LocalSettings.Instance.CurrentRefreshedIndex = index + 1;

                    // Refresh
                    await podcast.RefreshAsync(true, true, false);

                    await Library.SaveAsync();

                    CoreTools.SetBadgeNumber(LocalSettings.Instance.NewEpisodesCount);

                    // Update playlist
                    await Playlist.CurrentPlaylist.SaveAsync();
                }
            }
            catch
            {
                // Ignore error
            }

            deferral.Complete();
        }