Итак, я сделал специальный MessageBox, чтобы во время загрузки файла появлялся MessageBox с загрузочным GIF.
Но дело в том, что он не продолжается до остальной части кода, он просто останавливается до тех пор, пока человек не выйдет из этого MessageBox, затем он продолжит процесс.
Я все ещедовольно плохо знаком с кодированием, поэтому я не знаю точного сценария для написания.
var output = Path.Combine(Path.GetTempPath(), fileName);
System.Windows.Forms.MessageBox.Show($"{fileName} Will Now Start Downloading.", "Something",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
MsggBox = new Form3();
MsggBox.ShowDialog();
//Right Here I want the Custom MessageBox(Form3) to Pop up and continue with the script. But it just stops the whole script.
using (System.Net.WebClient client = new System.Net.WebClient())
{
client.DownloadFileCompleted += (sender, args) =>
{
System.Windows.Forms.MessageBox.Show($"{fileName} Download Complete!", "Something",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
Process.Start(output);
_Busy = false;
};
client.DownloadProgressChanged += (sender, args) => progressBar1.Value = args.ProgressPercentage;
client.DownloadFileAsync(new Uri(url), output);
}
}