Exemplo n.º 1
0
        private async void PodList_ItemClick(object sender, ItemClickEventArgs e)
        {
            Windows.Web.Syndication.SyndicationClient client = new Windows.Web.Syndication.SyndicationClient();
            Windows.Web.Syndication.SyndicationFeed   feed;

            Podcast poddy = e.ClickedItem as Podcast;

            string feedName = poddy.stationURL;

            Uri rssFeed = new Uri(feedName);

            try
            {
                feed = await client.RetrieveFeedAsync(rssFeed);

                PushFeedToDetails(feed);
            } catch
            {
                await Show_Error_Dialog("There's a problem downloading that feed. " +
                                        "If you're connected to the Internet, double-check the RSS URL.");
            }
        }
Exemplo n.º 2
0
        private async Task OOBE()
        {
            // If you haven't used the application before, this will bootstrap you with a sample XML file
            // and create the root folder and download subfolder.

            // Let's look for the folders...

            try {
                StorageFolder podBlasterParent = await KnownFolders.MusicLibrary.GetFolderAsync(@"PodBlaster");

                StorageFolder podBlasterDownloads = await KnownFolders.MusicLibrary.GetFolderAsync(@"PodBlaster\Downloads");
            } catch
            {
                StorageFolder musicLibrary = await KnownFolders.MusicLibrary.CreateFolderAsync(@"PodBlaster");

                StorageFolder musicLibraryDownloads = await musicLibrary.CreateFolderAsync(@"Downloads");
            }

            // Let's look for an XML file...

            try
            {
                StorageFolder podBlasterParent = await KnownFolders.MusicLibrary.GetFolderAsync(@"PodBlaster");

                StorageFile podBlasterXML = await podBlasterParent.GetFileAsync(@"stations.xml");
            } catch {
                StorageFolder podBlasterParent = await KnownFolders.MusicLibrary.GetFolderAsync(@"PodBlaster");

                XmlDocument outputXML = new XmlDocument();


                XmlElement rootElement = outputXML.CreateElement(string.Empty, "stations", string.Empty);
                outputXML.AppendChild(rootElement);

                XmlSignificantWhitespace sigws = outputXML.CreateSignificantWhitespace("\n\t");
                rootElement.InsertAfter(sigws, rootElement.FirstChild);

                List <Podcast> starterList = new List <Podcast>();
                Podcast        replyAll    = new Podcast();
                replyAll.stationName = "Reply All";
                replyAll.stationURL  = "http://feeds.gimletmedia.com/hearreplyall";

                starterList.Add(replyAll);

                foreach (Podcast thisOne in starterList)
                {
                    XmlElement stationElement = outputXML.CreateElement(string.Empty, "station", string.Empty);

                    XmlElement stationNameElement = outputXML.CreateElement(string.Empty, "stationName", string.Empty);

                    XmlText text1 = outputXML.CreateTextNode(thisOne.stationName);
                    stationNameElement.AppendChild(text1);
                    stationElement.AppendChild(stationNameElement);
                    stationElement.InsertAfter(sigws, stationNameElement);

                    XmlElement stationURLElement = outputXML.CreateElement(string.Empty, "stationURL", string.Empty);

                    XmlText text2 = outputXML.CreateTextNode(thisOne.stationURL);
                    stationURLElement.AppendChild(text2);
                    stationElement.AppendChild(stationURLElement);
                    stationElement.InsertAfter(sigws, stationURLElement);
                    rootElement.AppendChild(stationElement);
                }

                Debug.WriteLine(outputXML.InnerXml.ToString());

                string      XMLFilePath = podBlasterParent.Path + @"\stations.xml";
                StorageFile XMLFile     = await podBlasterParent.CreateFileAsync("stations.xml");

                await FileIO.WriteTextAsync(XMLFile, outputXML.InnerXml.ToString());

                Debug.WriteLine("Wrote out XML File!");
            }
        }