GetFeedAsync() публичный Метод

public GetFeedAsync ( string url ) : void
url string
Результат void
Пример #1
0
        void PoliticianPivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
        {
            //HACK: remove any progress bar that inadvertently wasn't destroyed
            RemoveProgressBar();

            if (e.Item.Name == "BillsPivotItem")
            {
                try
                {
                    AddProgressBar();

                    string memberCode;
                    if (App.ViewModel.SelectedPolitician.IsSenator)
                    {
                        memberCode = "SMEMB";
                    }
                    else
                    {
                        memberCode = "HMEMB";
                    }

                    StringBuilder sb = new StringBuilder();
                    sb.Append("Dbd111=d111");
                    sb.Append("&srch=/bss/d111query.html");
                    sb.Append("&TYPE1=bimp");
                    sb.AppendFormat("&{0}={1}", memberCode, App.ViewModel.SelectedPolitician.LastName);
                    sb.Append("&Sponfld=SPON");
                    string data        = sb.ToString();
                    string dataEncoded = data.Replace("/", "%2F");

                    Byte[] bytes = Encoding.UTF8.GetBytes(dataEncoded);
                    ThomasBillsBrowser.Navigate(new Uri("http://thomas.loc.gov/cgi-bin/bdquery"), bytes, "Content-Type: application/x-www-form-urlencoded");
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "VotesPivotItem")
            {
                try
                {
                    AddProgressBar();

                    RssFeed recentVoteFeed = new RssFeed();
                    recentVoteFeed.FeedCompleted += new EventHandler <FeedCompletedEventArgs>(recentVoteFeed_FeedCompleted);
                    recentVoteFeed.FeedError     += new EventHandler(recentVoteFeed_FeedError);
                    recentVoteFeed.GetFeedAsync(String.Format("http://www.govtrack.us/users/events-rss2.xpd?monitors=pv:{0}&days=30", App.ViewModel.SelectedPolitician.GovTrackId));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "TwitterPivotItem")
            {
                try
                {
                    AddProgressBar();

                    RssFeed twitterTimelineFeed = new RssFeed();
                    twitterTimelineFeed.FeedCompleted += new EventHandler <FeedCompletedEventArgs>(twitterTimelineFeed_FeedCompleted);
                    twitterTimelineFeed.FeedError     += new EventHandler(twitterTimelineFeed_FeedError);
                    twitterTimelineFeed.GetFeedAsync(String.Format("http://twitter.com/statuses/user_timeline/{0}.rss", App.ViewModel.SelectedPolitician.TwitterId));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "WebPivotItem")
            {
                AddProgressBar();

                try
                {
                    WebSiteBrowser.Navigate(new Uri(App.ViewModel.SelectedPolitician.WebSite));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "ContactPivotItem")
            {
                ContactPivotItem.DataContext = App.ViewModel.SelectedPolitician;
            }
        }
Пример #2
0
        void PoliticianPivot_LoadedPivotItem(object sender, PivotItemEventArgs e)
        {
            //HACK: remove any progress bar that inadvertently wasn't destroyed
            RemoveProgressBar();

            if (e.Item.Name == "BillsPivotItem")
            {
                try
                {
                    AddProgressBar();

                    string memberCode;
                    if (App.ViewModel.SelectedPolitician.IsSenator)
                        memberCode = "SMEMB";
                    else
                        memberCode = "HMEMB";

                    StringBuilder sb = new StringBuilder();
                    sb.Append("Dbd111=d111");
                    sb.Append("&srch=/bss/d111query.html");
                    sb.Append("&TYPE1=bimp");
                    sb.AppendFormat("&{0}={1}", memberCode, App.ViewModel.SelectedPolitician.LastName);
                    sb.Append("&Sponfld=SPON");
                    string data = sb.ToString();
                    string dataEncoded = data.Replace("/", "%2F");

                    Byte[] bytes = Encoding.UTF8.GetBytes(dataEncoded);
                    ThomasBillsBrowser.Navigate(new Uri("http://thomas.loc.gov/cgi-bin/bdquery"), bytes, "Content-Type: application/x-www-form-urlencoded");
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "VotesPivotItem")
            {
                try
                {
                    AddProgressBar();

                    RssFeed recentVoteFeed = new RssFeed();
                    recentVoteFeed.FeedCompleted += new EventHandler<FeedCompletedEventArgs>(recentVoteFeed_FeedCompleted);
                    recentVoteFeed.FeedError += new EventHandler(recentVoteFeed_FeedError);
                    recentVoteFeed.GetFeedAsync(String.Format("http://www.govtrack.us/users/events-rss2.xpd?monitors=pv:{0}&days=30", App.ViewModel.SelectedPolitician.GovTrackId));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "TwitterPivotItem")
            {
                try
                {
                    AddProgressBar();

                    RssFeed twitterTimelineFeed = new RssFeed();
                    twitterTimelineFeed.FeedCompleted += new EventHandler<FeedCompletedEventArgs>(twitterTimelineFeed_FeedCompleted);
                    twitterTimelineFeed.FeedError += new EventHandler(twitterTimelineFeed_FeedError);
                    twitterTimelineFeed.GetFeedAsync(String.Format("http://twitter.com/statuses/user_timeline/{0}.rss", App.ViewModel.SelectedPolitician.TwitterId));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "WebPivotItem")
            {
                AddProgressBar();

                try
                {
                    WebSiteBrowser.Navigate(new Uri(App.ViewModel.SelectedPolitician.WebSite));
                }
                catch
                {
                    RemoveProgressBar();
                }
            }
            else if (e.Item.Name == "ContactPivotItem")
            {
                ContactPivotItem.DataContext = App.ViewModel.SelectedPolitician;
            }
        }