![]() ![]() However I need to convert this command into httpwebrequest into VB.NET. It works just fine when I am running the curl command via CMD. It sounds like you want to use DownloadFileTaskAsync instead of DownloadFileAsync. It makes a post request where it tells the file path to the API which is mentioned in -data-raw and downloads that excel file into the defined path for example in the above case in D. ![]() You could show multiple progress bars, although that's not the most scalable solution, so would you expect the progress bar to reflect the total progress across all requests? The question is if you have all file downloads occurring simultaneously, but you only have one progress bar, how should the progress be updated? If all file downloads update the same progress bar with their progress they'll all just be overwriting each other's progress. There's a similar version of this method WebClient.DownloadFileTaskAsync that returns a Task, so you could go through your loop calling this method, adding each Task to a collection, then calling Task.WhenAll after the loop, which you can use to wait for all your file downloads to complete. DownloadFileAsync is non-blocking, so it'll schedule the request & notify consumers by firing the WebClient.DownloadFileCompleted event once it's finished. The WebClient.DownloadFileAsync method only supports one active request per WebClient instance, so you'd have to either wait for the previous request to complete before initiating the next request, or you'd need to use one WebClient instance per request.
0 Comments
Leave a Reply. |