コード例 #1
0
        public async override void Execute()
        {
            var newPodcastUrl = newSubscriptionService.GetSubscriptionUrl();

            if (newPodcastUrl != null)
            {
                var pod = new Podcast()
                {
                    SubscriptionUrl = newPodcastUrl
                };
                try
                {
                    await podcastLoader.UpdatePodcast(pod);

                    subscriptionManager.AddSubscription(pod);
                    Utils.AddPodcastToTreeView(pod, subscriptionView);
                }
                catch (WebException)
                {
                    messageBoxDisplayService.Show("Sorry, that podcast could not be found. Please check the URL");
                }
                catch (XmlException)
                {
                    messageBoxDisplayService.Show("Sorry, that URL is not a podcast feed");
                }
            }
        }
コード例 #2
0
        public override async void Execute()
        {
            var newPodcastSubscription = newSubscriptionService.GetSubscriptionUrl();

            if (newPodcastSubscription != null)
            {
                var newPodcast = new Podcast()
                {
                    SubscriptionUrl = newPodcastSubscription
                };
                try
                {
                    await podcastLoader.UpdatePodcast(newPodcast);

                    subscriptionManager.AddPodcast(newPodcast);
                    Utils.AddPodcastToSubscriptionView(subscriptionView, newPodcast);
                }
                catch (WebException)
                {
                    messageBoxDisplayService.Show("Sorry, that podcast could not be found. Please check the URL");
                }
                catch (XmlException)
                {
                    messageBoxDisplayService.Show("Sorry, the URL is not a podcast feed");
                }
                catch (XmlRssChannelNodeNotFoundException ex)
                {
                    messageBoxDisplayService.Show(ex.Message);
                }
            }
        }
コード例 #3
0
        public async override void Execute()
        {
            var newPodcastUrl = newSubscriptionService.GetSubscriptionUrl();

            if (newPodcastUrl != null)
            {
                var pod = new Podcast {
                    SubscriptionUrl = newPodcastUrl
                };
                try
                {
                    await podcastLoader.UpdatePodcast(pod);

                    subscriptionManager.AddSubscription(pod);
                    EventAggregator.Instance.Publish(new PodcastLoadedMessage(pod));
                }
                catch (WebException)
                {
                    messageBoxDisplayService.Show("Sorry, that podcast could not be found. Please check the URL");
                }
                catch (XmlException)
                {
                    messageBoxDisplayService.Show("Sorry, that URL is not a podcast feed");
                }
            }
        }
コード例 #4
0
        private async void MainFormViewOnLoad(object sender, EventArgs eventArgs)
        {
            foreach (var pod in podcasts)
            {
                var podcast = pod;
                await podcastLoader.UpdatePodcast(podcast);

                AddPodcastToTreeView(pod);
            }

            SelectFirstEpisode();

            if (settingsService.FirstRun)
            {
                messageBoxDisplayService.Show("Welcome! Get started by clicking Add to subscribe to a podcast");
                settingsService.FirstRun = false;
                settingsService.Save();
            }
        }
コード例 #5
0
        private async void OnMainFormLoad(object sender, EventArgs e)
        {
            foreach (var pod in _podcasts)
            {
                await _podcastLoader.UpdatePodcast(pod);

                AddPodcastToTreeView(pod);
            }

            SelectFirstEpisode();

            if (!_settingsService.FirstRun)
            {
                return;
            }
            _messageBoxDisplayService.Show("Welcome! Get started by clicking Add to subscribe to a new podcast.");
            _settingsService.FirstRun = false;
            _settingsService.Save();
        }
コード例 #6
0
        private async void MainFormViewOnLoad(object sender, EventArgs eventArgs)
        {
            foreach (var pod in subscriptionManager.Subscriptions)
            {
                var podcast = pod;
                await podcastLoader.UpdatePodcast(podcast);

                EventAggregator.Instance.Publish(new PodcastLoadedMessage(podcast));
            }

            EventAggregator.Instance.Publish(new PodcastLoadCompleteMessage(subscriptionManager.Subscriptions.ToArray()));

            if (settingsService.FirstRun)
            {
                messageBoxDisplayService.Show("Welcome! Get started by clicking Add to subscribe to a podcast");
                settingsService.FirstRun = false;
                settingsService.Save();
            }
        }
コード例 #7
0
        private async void MainFormViewOnLoad(object sender, EventArgs eventArgs)
        {
            foreach (var pod in subscriptionManager.Subscriptions)
            {
                var podcast         = pod;
                var podcastLoadTask = podcastLoader.UpdatePodcast(podcast);
                var firstFinished   = await Task.WhenAny(podcastLoadTask, Task.Delay(5000));

                if (firstFinished == podcastLoadTask)
                {
                    EventAggregator.Instance.Publish(new PodcastLoadedMessage(podcast));
                }
            }

            if (settingsService.FirstRun)
            {
                messageBoxDisplayService.Show("Welcome! Get started by clicking Add to subscribe to a podcast");
                settingsService.FirstRun = false;
                settingsService.Save();
            }
        }
コード例 #8
0
        private async void MainFormViewOnLoad(object sender, EventArgs eventArgs)
        {
            foreach (var podcast in subscriptionManager.Podcasts)
            {
                var podcastLoadTask = Task.Run(() => podcastLoader.UpdatePodcast(podcast));
                var firstFinished   = await Task.WhenAny(podcastLoadTask, Task.Delay(5000));

                if (firstFinished == podcastLoadTask)
                {
                    Utils.AddPodcastToSubscriptionView(subscriptionView, podcast);
                    if (subscriptionView.SelectedNode == null && !subscriptionView.IsEmpty())
                    {
                        Utils.SelectFirstEpisode(subscriptionView, subscriptionManager);
                    }
                }
            }

            if (settingsService.FirstRun)
            {
                messageBoxDisplayService.Show("Welcome! Get started by clicking Add to subscribe to a podcast");
                settingsService.FirstRun = false;
                settingsService.Save();
            }
        }