Is there a way for example to notify the main GUI thread of the end of the Elapsed
method of a System.Timer
?
My real situation is this:
I have a class in business logic that uses a System.Timer
to do routine operations, since the timer uses the pool thread I cannot use events that I use in the GUI because rightly these events will be invoked in a different GUI thread.
What I would need is some kind of notification informing my GUI thread that the Elapsed
method is finished and then I can update the GUI fields.
It's possible?
A solution that I had thought of is to use the System.Windows.Forms.Timer
that in its Tick
method I do all the operations in an async await, but I don't like it so much because I want to leave the GUI without business logic work and I wanted to understand if there are other possible ways for this situation of mine.