I
ignace.sys@kluwer.be
Guest
I want to download files. The file download works but the events DownloadProgressChanged and DownloadFileCompleted are not fired. I've rried the code in C#: works perfect. What am i doing wrong ? Thanks, Ignace /*************************************** Code ***************************************/ USING System.Net.*. USING System.*. USING System.ComponentModel.*. CLASS DownloadFile: DEF VAR Client AS WebClient. DEF VAR w-File AS Uri. METHOD PUBLIC VOID StartDownload(INPUT p-File AS CHARACTER,INPUT p-Target AS CHARACTER): Client = NEW WebClient(). w-File = NEW Uri(p-File). Client
ownloadProgressChanged:Subscribe(Client_DownloadProgressChanged). Client
ownloadFileCompleted:Subscribe(Client_DownloadFileCompleted). Client
ownloadFileAsync (w-File, p-Target). END METHOD. METHOD PRIVATE VOID Client_DownloadProgressChanged(sender AS System.Object, e AS DownloadProgressChangedEventArgs ) : MESSAGE e
rogressPercentage VIEW-AS ALERT-BOX INFO BUTTONS OK. END METHOD. METHOD PUBLIC VOID Client_DownloadFileCompleted(sender AS System.Object, e AS AsyncCompletedEventArgs ) : MESSAGE "Download completed!" VIEW-AS ALERT-BOX INFO BUTTONS OK. END METHOD. END CLASS. /* private void btnDownload_Click(object sender, EventArgs e) { WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); webClient.DownloadFileAsync(new Uri("http://mysite.com/myfile.txt"), @"c:\myfile.txt"); } private void Completed(object sender, AsyncCompletedEventArgs e) { MessageBox.Show("Download completed!"); } */
Continue reading...
Continue reading...