c# - Winform check Invokerequired for each tabpages in a tabcontrol -


i have winform app in main form has tabcontrol, 1 thread create or remove tabpages frequently.and other background threads data , need visit each tabpage's control inside it. code here , can work:

public void getcustomermessage()             {                     if (this.tabcontrol.invokerequired == true)                     {                         customerinforhandler handler = getcustomermessage;                         this.tabcontrol.invoke(handler);                     }                     else                     {                         //code update in tabpages                         //with foreach tabpage in tabcontrols , use begininvoke                     }               } 

the problem is, realize in fact background thread need visit tabpage, not tabcontrol, right check invokerequired property of tabcontrol, or need check each tabpage's invokerequired ? because feel ui block short time.

is mean when tabcontrol can visit ui thread, not equals tabpage inside can this? or can optimized?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -