My Plan
- Have a system that holds some objects
- Have a winforms-form that displays some key values of these objects
- When certain changes occur(object gets add / removed / datat change): Update GUI
My Idea
- subscribe my form to events in the objects
- update form when objects chamge (/raise events)
My Troubles
- winforms (for good reasons) does not allow for changes coming from foreign threads
- an eventHandler is in fact run in the thread of the object calling
- hence .net throws an exception and I'm done.
Question:
Is there a way to manipulate a form through events not raised by itself?
Alternatively:
Is there a way I can "nudge" my form to say "hey, better check your data, there's something new", without having to constantly poll?
Invoke
/BeginInvoke
on your winforms controls in order to update them from another thread. Example: stackoverflow.com/questions/10775367/…