1
public RSS_Reader()
{
this.InitializeComponent();
}
public static async Task<string> DownloadPageAsync(string pageURL)
{
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync("http://www.parliament.uk/g/RSS/news-feed/?pageInstanceId=209&limit=20");
HttpContent content = response.Content;
string result = await content.ReadAsStringAsync();
return result;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var parameter = e.Parameter as string;
strURL = parameter.ToString();
Task<string> strXML = DownloadPageAsync(strURL);
ListBoxRss.Items.Add(strXML.Result);
}
私が作ったwp8アプリケーションの一部です。上のコードを読んだところから2番目のページにリンクする、アプリケーションのメインのランディングページがあります。 2番目のページは実際にはロードされず、最初のページにハングアップします。WPF async httpclientが文字列を返さない
どうしたのですか?おかげさまで
を! – luigivampa
本当にありがとうございます。 – luigivampa