以及只有async
請求被執行。對於WP7
,您可以執行async
請求並等待response
,根據response
您可以按照您的邏輯導航到頁面。要做到這一點,在Startup Page
:
在class's constructor
調用方法一樣NavigateToPages();
現在這種方法,你可以打電話給你想要的http reqeust
,當你得到response
轉到頁一樣,
void NavigateToPage()
{
WebClient client = new WebClient();
client.DownloadStringCompleted += (object sender, DownloadStringCompletedEventArgs e) =>
{
var result = e.Result;
//Navigate to page
}
client.DownloadStringAsync(new Uri("<your web request"));
}
這將等到你得到response
。同時表明你要請求web service
用戶可以添加ProgressIndicator
和啓動web request
啓動它,只是把「讀取響應」作爲text
,並在response
使其empty ""
之前。另外,建議您在try-catch-finally
區塊內撥打請求。因此,如果互聯網關閉或出現問題reponse
應用程序不應該崩潰。
我爲WP7做了這個,我認爲也應該爲WP8工作。如果你想嘗試一下。
只支持異步請求。 – thegiga