G
Guest
Hi,
I have the following code in a winform:
....
private delegate void DownloadDelegate(string src, string dest);
....
private void DownloadFile(string src, string dest)
{
WebClient wc = new WebClient();
wc.DownloadFile(src, dest);
}
....
DownloadDelegate download = new DownloadDelegate(DownloadFile);
BeginInvoke(download, new object[] {"http://www.a.com/file.exe",
"C:\\file.exe"});
....
I am using delegate so that it won't freeze my winform while I am doing
other stuff. The download process is good (downloading the files), but my
winform is still frozen, not until all download is done.
Anyone know why? Or... any better way to do this - downloading and updating
the winform in the same time?
Please advice, thanks!
-P
I have the following code in a winform:
....
private delegate void DownloadDelegate(string src, string dest);
....
private void DownloadFile(string src, string dest)
{
WebClient wc = new WebClient();
wc.DownloadFile(src, dest);
}
....
DownloadDelegate download = new DownloadDelegate(DownloadFile);
BeginInvoke(download, new object[] {"http://www.a.com/file.exe",
"C:\\file.exe"});
....
I am using delegate so that it won't freeze my winform while I am doing
other stuff. The download process is good (downloading the files), but my
winform is still frozen, not until all download is done.
Anyone know why? Or... any better way to do this - downloading and updating
the winform in the same time?
Please advice, thanks!
-P