Tuesday, March 16, 2010

Multi-threading mechanisms to run some lengthy operations from winforms code and communication with GUI

Programmer Question

What do I want to achieve: I want to perform some time consuming operations from my MDI winforms application (C# - .NET).



An MDI child form may create the thread with the operation, which may take long time (from 0.1 seconds, to even half hour) to complete. In the meantime I want the UI to respond to user actions, including manipulation of data in some other MDI child form. When the operation completes, the thread should notify the MDI child that the calculations are done,
so that the MDI child can perform the post-processing.



How can I achieve this:
Should I use explicit threading (i.e., create explicit threads), thread pools? Or simply just propose your solution. Should I create foreground or background threads?



And how does the thread communicates with the GUI, according the solution you propose?



If you know of a working example that handles a similar situation, please make a note.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails