I have a three layer application in C#. In business layer i have many threads that do same job .
I want to show the progress of each thread on UI , but i don’t have the reference of presentation layer .
How can i do this ? What’s the best way for this ?
Thanks .
The most appropriate answer here is probably to expose an
eventsomewhere on your business layer. Your UI code can subscribe to the event, and handle the event by switching to the UI thread (if necessary) and update itself.Then the business code doesn’t need to know about the UI, and can work the same without any UI (but as with all delegates / callbacks, you need to check for
nullbefore attempting to invoke the delegate).