Time for action - Understanding how to invoke delegates step-by-step
Now, we are going to execute the code in the
AddToListBox method step-by-step, to have a better understanding of how delegates work in order to update the UI from worker threads:
- Stay in the project,
- Open the code for the Windows Form
- Define a new breakpoint in the line
if (libFilesEncrypted.InvokeRequired) in the
- Press F5 or select Debug | Start Debugging in the main menu. Make sure the Threads window is visible.
- Copy just one text file to be encrypted (around 10 megabytes in size to generate a processing impact) into the input folder while the application runs.
- After a few seconds, when the working thread finishes the ...