winforms - Update the GUI from another thread in C# - change back to the main thread or not? -


i know simplest way update label thread is:

void dosomething() {     if (invokerequired)     {         invoke(new methodinvoker(dosomething));     } else      {         //     } } 

my question if instead of if require update gui thread possible change main thread , update gui there ?

actually, simplest way is

invoke(new methodinvoker(dosomething)); 

if call thread sure, ie. if know, invokerequired true.

also, use winforms timer poll changes of, say, text field. timer runs in gui thread. pretty solution if have hundreds of events per second. or @ least "a lot of". way don't have many switches gui thread (which take considerable amount of time).


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -