2016-06-12 11 views
0

ダウンロードファイルをダウンロードして、20%、40%ハングとき - それは完了したが、ファイルが完全にC#ハング

修正する方法をダウンロードされていないかのように、ある>client_DownloadFileCompletedを?

MessageBox.Show("Пожалуйста ожидайте начинаем процесс скачивание клиента", "тест", 
MessageBoxButtons.OK, MessageBoxIcon.Information); 
WebClient client = new WebClient(); 
client.Proxy = null; 
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); 
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); 
client.DownloadFileAsync(new Uri("http://***/test.7z"), @"test.7z"); 


    void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) 
    { 
     MessageBox.Show("Клиент успешно скачался,Ожидайте идет процесс распаковки.", "тест", MessageBoxButtons.OK, MessageBoxIcon.Information); 

答えて

0

プログラマがAsyncCompletedEventArgs.Cancelledと.ERRORプロパティをチェックしていないVB.NET DownloadFileAsync fires completion event but doesn't downloadの重複のように見えます。

ダウンロードが成功するとイベントが発生すると想定していますが、実際にダウンロードが完了すると起動します。ダウンロードの失敗を報告している可能性があります。イベントに渡されたイベントargsをチェックして、成功したかどうかを確認します。

関連する問題