J
J.Marsch
I know that the controls on a Winform are not thread safe, and that you want
to do all of your UI updates on a single thread -- generally the main
thread.
Now, 2 questions:
1. Does the one thread that you can use to update controls have to be the
thread that you were on when you instanced the form?
2. Can 2 forms in the same application have affinity for different threads,
or do you want all of the forms in an application to be created on the main
thread?
Why I'm asking:
I'm working on a module that will place an item in system tray. The code
associated with the tray item will use a secondary thread to listen for
system events, and based on some of the events, it might have to launch a
form. Do I need to work in some logic to make sure that the form launch
code is always executed by the main thread?
to do all of your UI updates on a single thread -- generally the main
thread.
Now, 2 questions:
1. Does the one thread that you can use to update controls have to be the
thread that you were on when you instanced the form?
2. Can 2 forms in the same application have affinity for different threads,
or do you want all of the forms in an application to be created on the main
thread?
Why I'm asking:
I'm working on a module that will place an item in system tray. The code
associated with the tray item will use a secondary thread to listen for
system events, and based on some of the events, it might have to launch a
form. Do I need to work in some logic to make sure that the form launch
code is always executed by the main thread?