C# Depends on the rolling of the file.
-
It's about 20 per cent, 40 per cent, and then it hangs and rolls.
client_DownloadFileCompleted
I mean, how it's done, but the file isn't completely downloaded.How do you fix that?
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);
-
You've got the processing written in such a way that it's not clear whether the async task has been successfully completed. The properties of AsyncCompletedEventArgs should be analysed.
private void DownloadCompleted(Object sender, AsyncCompletedEventArgs e) { if (e.Cancelled) { //Тут обработка в случае сброса } else if (e.Error) { //Тут обработка в случае ошибки } else { MessageBox.Show("Клиент успешно скачался, Ожидайте идет процесс распаковки.", "тест", MessageBoxButtons.OK, MessageBoxIcon.Information); }
}