コード例 #1
0
        public async void AddPodcastAsync()
        {
            try
            {
                var corePodcast = await podcastService.GetPodcastAsync(feedUrl);

                var podcastModel = new PodcastViewModel(corePodcast);

                if (!podcasts.Contains(podcastModel))
                {
                    podcasts.Add(podcastModel);
                    await podcastService.SavePodcastAsync(corePodcast);
                }
                else
                {
                }

                FeedUrl = string.Empty;
            }
            catch (GetPodcastException ex)
            {
                var result = await dialogService.ShowDialogAsync(ex.Message, "Error!", new[]
                {
                    new UICommand("Retry")
                    {
                        Id = 0
                    },
                    new UICommand("Cancel")
                    {
                        Id = 1
                    },
                    new UICommand("test")
                    {
                        Id = 2
                    }
                }, 0);

                if ((int)result.Id == 0)
                {
                    AddPodcastAsync();
                }
                else
                {
                }
            }
        }
コード例 #2
0
        private async Task LoadEpisodeAsync()
        {
            episodes.Clear();
            var tempEpisodes = new List <EpisodeViewModel>();
            var podcasts     = await podcastService.GetPodcastsAsync();

            foreach (var podcast in podcasts)
            {
                var podcastVm = new PodcastViewModel(podcast);
                tempEpisodes.AddRange(podcastVm.Episodes);
            }
            tempEpisodes = tempEpisodes.OrderBy(ep => ep.Episode.Published).ToList();
            foreach (var episode in tempEpisodes)
            {
                episodes.Add(episode);
            }
        }