2
這是我用來下載一個URL爲html的代碼。事情是,有什麼辦法可以做 這個異步?我想知道問題的答案是否成功,以及程序繼續之前的迴應是什麼。如果你可以等待client.DownloadStringAsync和task.delay,它將是完美的,除了我不喜歡設置標準時間等待的想法之外,它並不總是有效。謝謝!異步Web響應Windows Phone 8
Uri uri = new Uri(url);
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.AllowReadStreamBuffering = true;
client.DownloadStringAsync(uri);
不要使用異步,然後。使用同步,這將阻塞,直到操作完成 –