Exemplo n.º 1
0
        public override async Task Appearing()
        {
            if (LocationResources?.Count == 0)
            {
                SetL10NResources();
            }

            if (Podcast.Channel == null)
            {
                IsBusy = true;
                _dialogService.ShowLoading();
                try
                {
                    var podcast = Podcast;
                    _podcast = null;

                    if (!string.IsNullOrEmpty(podcast.FeedUrl))
                    {
                        podcast.Channel = await _podcastService.GetPodcastFeedAsync(podcast.FeedUrl);

                        podcast.Channel = ReflectionHelper.ConvertNullToEmpty(podcast.Channel);
                        //podcast.Channel.Episodes = podcast.Channel.Episodes.OrderByDescending(x => x.EpisodeNumber).ToList();

                        Podcast = podcast;

                        Debug.WriteLine($"Number of tracks: {Podcast.NumberTracks}, Count: {podcast.Channel.Episodes.Count}");
                    }
                    else
                    {
                        //add some error message...
                        await NavService.Close <PodcastViewModel>();
                    }
                }
                catch (Exception ex)
                {
                    Ui.Handle(ex as dynamic);
                }
                finally
                {
                    IsBusy = false;
                    _dialogService.HideLoading();
                }
            }
            else
            {
                RaisePropertyChanged(nameof(Podcast));
            }
        }