public static void SelectFirstEpisode(ISubscriptionView subscriptionView, ISubscriptionManager subscriptionManager) { if (!subscriptionView.IsEmpty()) { subscriptionView.SelectNode(subscriptionManager.Podcasts.SelectMany(p => p.Episodes).First().Guid); } }
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(); } }