try
{
ProgressBar.Visible = true;
WebClient webClient = new WebClient();
DownloadStatusLabel.Visible = true;
DownloadStatusLabel.Text = "Скачивание " + filename;
webClient.DownloadProgressChanged += (s, e) =>
{
ProgressBar.Width = ProgressBar.Width + 1;
};
webClient.DownloadDataCompleted += (t, r) =>
{
GameStart();
Process.GetCurrentProcess().Kill();
};
webClient.DownloadFileCompleted += (s, e) =>
{
ProgressBar.Width = 0;
DownloadStatusLabel.Visible = true;
DownloadStatusLabel.Text = "Загрузка: " + filename;
if (filename == Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + FullPathJar + "/bin/natives/OpenAL64.dll")
{
ButtonAuth.Enabled = true;
ButtonReg.Enabled = true;
Login.Enabled = true;
Password.Enabled = true;
DownloadStatusLabel.Visible = false;
}
};
webClient.DownloadFileAsync(new Uri(url), filename);
}
catch(Expection ex)
{
MessageBox.Show(ex.ToString());
}