Пример #1
0
        private void LoadFeeds()
        {
            try
            {
                //Get the list of xml feeds from Alex's site
                ApplicationBarIconButton AppButton = (ApplicationBarIconButton)ApplicationBar.Buttons[0];
                AppButton.IsEnabled = false;
                AppButton = null;

                MediaStop();

                GAB_List.Clear();
                GABList.Items.Clear(); //UI List

                GAB GAB_Item = new GAB();

                //The live feed
                GAB_Item.Title = "Great American Broadcast Network Live";
                GAB_Item.Description = "Entertainment 24/7";
                GAB_Item.BroadcastDate = DateTime.Now;
                GAB_Item.URL = "http://http.yourmuze.com/gab-1/aacplus-64-s.aac";
                GAB_List.Add(GAB_Item);

                WebClient webClient = new WebClient();
                webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webClient_DownloadListCompleted);
                webClient.DownloadStringAsync(new System.Uri("http://alexbennett.com/podcast/gabfeeds.txt"));
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Пример #2
0
        private void LoadList()
        {
            try
            {
                GAB GAB_Item = new GAB();

                GABList.Items.Clear(); //Clear the UI list

                //Sort desending (notice the negative before the "x")
                GAB_List.Sort((x, y) => -x.BroadcastDate.CompareTo(y.BroadcastDate));

                //Load the items into the list
                for (int iGAB = 0; iGAB < GAB_List.Count(); iGAB++)
                {
                    GAB_Item = GAB_List[iGAB];
                    this.GABList.Items.Add(GAB_Item.Title + Environment.NewLine + GAB_Item.Description);
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
            finally
            {
                ApplicationBarIconButton RefreshButton = (ApplicationBarIconButton)ApplicationBar.Buttons[2];
                RefreshButton.IsEnabled = true;
                RefreshButton = null;
            }
        }
Пример #3
0
        private void Feed_DownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    GAB GAB_Item;
                    XElement xmlitems = XElement.Parse(e.Result);
                    List<XElement> elements = xmlitems.Descendants("item").ToList();

                    foreach (XElement rssItem in elements)
                    {
                        GAB_Item = new GAB();
                        GAB_Item.Title = rssItem.Element("title").Value;
                        GAB_Item.Description = rssItem.Element("description").Value;
                        GAB_Item.URL = rssItem.Element("guid").Value;
                        GAB_Item.BroadcastDate = Convert.ToDateTime(rssItem.Element("pubDate").Value);

                        GAB_List.Add(GAB_Item);
                    }

                    LoadList();
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }