Ejemplo n.º 1
0
        private async void ResultsListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var source = e.ClickedItem as SearchResponseEntry;

            if (source == null)
            {
                return;
            }

            WaitRingManager.IsWaitRingVisible = true;

            var podcast = await Podcast.ParseAsync(source.feedUrl, false);

            WaitRingManager.IsWaitRingVisible = false;

            if (podcast != null)
            {
                GlobalStateManager.CurrentShell.Navigate(typeof(PodcastPage), podcast.ToString());
            }
        }
Ejemplo n.º 2
0
        private async void BrowseControl_OnUpdate(string url, string login, string password)
        {
            WaitRingManager.IsWaitRingVisible = true;

            try
            {
                if (!url.ContainsIgnoreCase("http"))
                {
                    url = "http://" + url;
                }

                var podcast = await Podcast.ParseAsync(url, false, login, password);

                GlobalStateManager.CurrentShell.Navigate(typeof(PodcastPage), podcast.ToString());
            }
            catch
            {
                await Messenger.ErrorAsync(StringsHelper.Error_UnableToParseRSS);
            }
            WaitRingManager.IsWaitRingVisible = false;
        }
Ejemplo n.º 3
0
        public static async Task <bool> DeletePodcast(Podcast podcast)
        {
            if (await Messenger.QuestionAsync(StringsHelper.Confirm_PodcastDelete))
            {
                foreach (var episode in podcast.Episodes)
                {
                    Playlist.CurrentPlaylist.RemoveEpisode(episode);

                    if (episode.DownloadInProgress)
                    {
                        episode.CancelDownload();
                    }
                }
                await Playlist.CurrentPlaylist.SaveAsync();

                RemovePodcast(podcast);
                CheckZombieFolders();

                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        private void PodcastCategoryMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem item = sender as MenuFlyoutItem;

            if (item != null)
            {
                podcastToEdit = item.DataContext as Podcast;
            }
            else
            {
                return;
            }

            if (podcastToEdit == null)
            {
                return;
            }

            var flyout = RootGrid.Resources["EditCategoryFlyout"] as Flyout;

            var gridViewItem = itemGridView.ContainerFromItem(podcastToEdit) as GridViewItem;

            flyout?.ShowAt(gridViewItem);
        }
Ejemplo n.º 5
0
        public static async Task LoadOPMLFile(StorageFile libraryFile, bool merge)
        {
            var document = new Windows.Data.Xml.Dom.XmlDocument();
            var content  = await FileIO.ReadTextAsync(libraryFile);

            document.LoadXml(content);

            var bodyNode        = document.DocumentElement.GetChildByName("body");
            var categoriesNodes = bodyNode.ChildNodes.Where(n => n is Windows.Data.Xml.Dom.XmlElement).Cast <Windows.Data.Xml.Dom.XmlElement>().ToArray();

            SuccessfullyLoaded = false;
            if (!merge)
            {
                Clear();
            }

            foreach (var categoryNode in categoriesNodes)
            {
                if (categoryNode.HasChildNodes())
                {
                    var category      = categoryNode.GetAttributeValue("text");
                    var podcastsNodes = categoryNode.ChildNodes.Where(n => n is Windows.Data.Xml.Dom.XmlElement).Cast <Windows.Data.Xml.Dom.XmlElement>().ToArray();
                    foreach (var podcastNode in podcastsNodes)
                    {
                        var feedUrl = podcastNode.GetAttributeValue("xmlUrl");

                        if (string.IsNullOrEmpty(feedUrl))
                        {
                            feedUrl = podcastNode.GetAttributeValue("text");
                        }

                        if (GetPodcastByFeedUrl(feedUrl) != null)
                        {
                            continue;
                        }

                        var podcast = await Podcast.ParseAsync(feedUrl, true);

                        if (podcast != null)
                        {
                            podcast.Category = category;
                            Podcasts.Add(podcast);
                            podcast.Clean();
                            podcast.CheckDownloads();
                            podcast.GetLocalImage();
                        }
                    }
                }
                else
                {
                    var feedUrl = categoryNode.GetAttributeValue("xmlUrl");

                    if (string.IsNullOrEmpty(feedUrl))
                    {
                        feedUrl = categoryNode.GetAttributeValue("text");
                    }

                    var podcast = await Podcast.ParseAsync(feedUrl, true);

                    if (podcast != null)
                    {
                        podcast.Category = StringsHelper.NoCategory;
                        Podcasts.Add(podcast);
                        podcast.CheckDownloads();
                        podcast.GetLocalImage();
                    }
                }
            }

            CheckZombieFolders();

            SuccessfullyLoaded = true;
        }