private void OnSelectedEpisodeChanged(object sender, EventArgs e) { podcastPlayer.UnloadEpisode(); if (subscriptionView.SelectedNode == null) { return; } var selectedEpisode = subscriptionView.SelectedNode.Tag as Episode; if (selectedEpisode != null) { mainFormView.ShowEpisodeView(); SaveEpisode(); currentEpisode = selectedEpisode; episodeView.Title = currentEpisode.Title; episodeView.PublicationDate = currentEpisode.PubDate; episodeView.Description = currentEpisode.Description; toolbarView.EpisodeIsFavourite = currentEpisode.IsFavourite; currentEpisode.IsNew = false; episodeView.Rating = currentEpisode.Rating; episodeView.Tags = String.Join(",", currentEpisode.Tags ?? new string[0]); episodeView.Notes = currentEpisode.Notes ?? ""; podcastPlayer.LoadEpisode(currentEpisode); } var selectedPodcast = subscriptionView.SelectedNode.Tag as Podcast; if (selectedPodcast != null) { mainFormView.ShowPodcastView(); podcastView.SetPodcastTitle(selectedPodcast.Title); podcastView.SetEpisodeCount(String.Format("{0} episodes", selectedPodcast.Episodes.Count)); } }
private 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.PubDate = 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 (subscriptionView.SelectedNode.Tag is Podcast selectedPodcast) { EventAggregator.Instance.Publish(new PodcastSelectedMessage(selectedPodcast)); mainFormView.ShowPodcastView(); podcastView.SetPodcastTitle(selectedPodcast.Title); podcastView.SetEpisodeCount($"{selectedPodcast.Episodes.Count} episodes"); } }
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); }); }
private async void OnSelectedEpisodeChanged(object sender, EventArgs e) { podcastPlayer.UnloadEpisode(); if (subscriptionView.SelectedNode == null) { return; } var selectedEpisode = subscriptionView.SelectedNode.Tag as Episode; if (selectedEpisode != null) { EventAggregator.Instance.Publish(new EpisodeSelectedMessage(selectedEpisode)); mainFormView.ShowEpisodeView(); SaveEpisode(); currentEpisode = selectedEpisode; episodeView.Title = currentEpisode.Title; episodeView.PublicationDate = currentEpisode.PubDate; episodeView.Description = currentEpisode.Description; //toolbarView.EpisodeIsFavourite = currentEpisode.IsFavourite; now handled by the IsFavouriteCommand 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.LoadPeaksAsync(); } episodeView.SetPeaks(currentEpisode.Peaks); } var selectedPodcast = subscriptionView.SelectedNode.Tag as Podcast; if (selectedPodcast != null) { EventAggregator.Instance.Publish(new PodcastSelectedMessage(selectedPodcast)); mainFormView.ShowPodcastView(); podcastView.SetPodcastTitle(selectedPodcast.Title); podcastView.SetEpisodeCount(String.Format("{0} episodes", selectedPodcast.Episodes.Count)); podcastView.SetPodcastUrl(selectedPodcast.Link); } }
private async void OnSelectedEpisodeChanged(object sender, EventArgs e) { _podcastPlayer.UnloadEpisode(); if (_subscriptionView.SelectedNode == null) { return; } if (_subscriptionView.SelectedNode.Tag is Episode selectedEpisode) { EventAggregator.EventAggregator.Instance.Publish(new EpisodeSelectedMessage(selectedEpisode)); _mainFormView.ShowEpisodeView(); SaveEpisode(); _currentEpisode = selectedEpisode; _episodeView.Title = _currentEpisode.Title; _episodeView.PublicationDate = _currentEpisode.PubDate; _episodeView.Description = _currentEpisode.Description; _episodeView.EpisodeIsFavorite = _currentEpisode.IsFavourite; _currentEpisode.IsNew = false; _episodeView.Rating = _currentEpisode.Rating; _episodeView.Tags = string.Join(",", _currentEpisode.Tags ?? new string[0]); _episodeView.Notes = _currentEpisode.Notes ?? ""; _podcastPlayer.LoadEpisode(selectedEpisode); if (_currentEpisode.Peaks == null || _currentEpisode.Peaks.Length == 0) { _episodeView.SetPeaks(null); _currentEpisode.Peaks = await _podcastPlayer.LoadPeaksAsync(); } _episodeView.SetPeaks(_currentEpisode.Peaks); } if (!(_subscriptionView.SelectedNode.Tag is Podcast selectedPodcast)) { return; } EventAggregator.EventAggregator.Instance.Publish(new PodcastSelectedMessage(selectedPodcast)); _mainFormView.ShowPodcastView(); _podcastView.SetPodcastTitle(selectedPodcast.Title); _podcastView.SetEpisodeCount($"{selectedPodcast.Episodes.Count} episodes"); }
private void OnPodcastSelected(PodcastSelectedMessage message) { podcastView.SetPodcastTitle(message.Podcast.Title); podcastView.SetEpisodeCount(String.Format("{0} episodes", message.Podcast.Episodes.Count)); podcastView.SetPodcastUrl(message.Podcast.Link); }