How can I wait for asynchronous surgery? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I wait for asynchronous surgery?

All good times of day! Who knows how to wait for asynchronous surgery? I use a crutch in the form of a bool variable and a cycle while with Task.Delay. Thank you in advance. P. S. I used a translator https://code.sololearn.com/ciu0K2815HKa/?ref=app

14th Mar 2021, 9:08 AM
Data Name ID
Data Name ID - avatar
2 Answers
+ 1
Place a listbox on the form. Add all messages to the listbox like ShowMessage("Download completed"); becomes Listbox1.Add("Download completed"); Doing it this way, you can follow every event that is being fired. Without clicking to many messageboxes. Make list of files you want to download Take the first file of the list in the buttonclick. Make a method "download" file. Start next download in download completed
15th Mar 2021, 5:57 PM
sneeze
sneeze - avatar
+ 1
Why do you want to do that ? You code seems to be ok. Asynchronous means you do not have to wait. If you need to do something after the file is downloaded do it in "download complete" event.
14th Mar 2021, 8:37 PM
sneeze
sneeze - avatar