public PodcastPresenter(IPodcastView podcastView)
 {
     this.podcastView = podcastView;
     EventAggregator.Instance.Subscribe <PodcastSelectedMessage>(m =>
     {
         podcastView.SetPodcastTitle(m.Podcast.Title);
         podcastView.SetEpisodeCount($"{m.Podcast.Episodes.Count} episodes");
         podcastView.SetPoscastUrl(m.Podcast.Link);
     });
 }
Esempio n. 2
0
        private async void OnSelectedEpisodeChanged(object sender, EventArgs e)
        {
            podcastPlayer.UnloadEpisode();
            if (subscriptionView.SelectedNode == null)
            {
                return;
            }
            if (subscriptionView.SelectedNode.Tag is Episode selectedEpisode)
            {
                EventAggregator.Instance.Publish(new EpisodeSelectedMessage(selectedEpisode));
                mainFormView.ShowEpisodeView();
                SaveEpisode();
                currentEpisode              = selectedEpisode;
                episodeView.Title           = currentEpisode.Title;
                episodeView.PublicationDate = currentEpisode.PubDate;
                episodeView.Description     = currentEpisode.Description;
                currentEpisode.IsNew        = false;
                episodeView.Rating          = currentEpisode.Rating;
                episodeView.Tags            = String.Join(",", currentEpisode.Tags ?? new string[0]);
                episodeView.Notes           = currentEpisode.Notes ?? "";
                podcastPlayer.LoadEpisode(currentEpisode);
                if (currentEpisode.Peaks == null || currentEpisode.Peaks.Length == 0)
                {
                    episodeView.SetPeaks(null);
                    currentEpisode.Peaks = await podcastPlayer.LoadPodcastAsync();
                }
                episodeView.SetPeaks(currentEpisode.Peaks);
            }

            if (subscriptionView.SelectedNode.Tag is Podcast selectedPodcast)
            {
                EventAggregator.Instance.Publish(new PodcastSelectedMessage(selectedPodcast));
                mainFormView.ShowPodcastView();
                podcastView.SetPodcastTitle(selectedPodcast.Title);
                podcastView.SetEpisodeCount($"{selectedPodcast.Episodes.Count} episodes");
                podcastView.SetPoscastUrl(selectedPodcast.Link);
            }
        }