public void patchFile(String path, FileRevision fr) { FileStream fs = File.OpenWrite(path); WebClient wc = new WebClient(); wc.DownloadFileCompleted += new AsyncCompletedEventHandler(delegate(object source, AsyncCompletedEventArgs args){ DownloadCompleted(fr); }); wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(delegate(object source, DownloadProgressChangedEventArgs args) { DownloadProgress(fr, args); }); }
void DownloadProgress(FileRevision fr, DownloadProgressChangedEventArgs args) { updateStatus(fr, (uint)args.ProgressPercentage); }
void DownloadCompleted(FileRevision fr) { updateStatus(fr, 100); }