private async void OnEpisodeSelected(EpisodeSelectedMessage episodeSelected) { podcastPlayer.UnloadEpisode(); SaveEpisode(); currentEpisode = episodeSelected.Episode; 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 ?? ""; episodeView.PositionInSeconds = 0; podcastPlayer.LoadEpisode(currentEpisode); if (currentEpisode.Peaks == null || currentEpisode.Peaks.Length == 0) { episodeView.SetPeaks(null); await podcastPlayer.LoadPeaksAsync(); } else { episodeView.SetPeaks(currentEpisode.Peaks); } }
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"); }