How could I execute an event, without it actually happening?
For example, how would I execute a button1_Click() event in code, without clicking the button?
The problem is that I have a WebClient, which doewnloads lists of files.
Each time it finishes downloading a file it executes a DownloadFileCompleted event, which then downloads the next file.
However, some files aren’t downloaded (all in plan), so the event is not executed. How could I execute it?
Thanks
Just insert all code present in the event handler in a separate function, like
and if you don’t what to raise an event, or can’t, just call
I personally against calling event handler esplicitly, but prefer this approach. To me seems more clear code structure.