private void OnButtonPlayClick(object sender, EventArgs e)
 {
     if (_currentEpisode == null)
     {
         return;
     }
     _podcastPlayer.LoadEpisode(_currentEpisode);
     _podcastPlayer.Play();
 }
        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; 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);
            }
            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));
            }
        }
Exemple #3
0
        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 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");
            }
        }
        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);
            }
        }