2009/01/20

cross thread for control handling in C#

P9200257 (by plateaukao)
Home.Chez moi

波紐~~~
mais c'est pas vraiment de poisson d'or.

****

In order to reduce the efforts of getting latest version of source codes from perforce server and compile it on the machine, I used the p4api .NET library in my program. However, it's a long process; so I have to use another thread to handle this task, and bring out the message sometimes to know current progress. I encountered a problem as the title says -- cross thread control handling. my task is done in a newly created thread; and the message will be printed in a listbox control, which is created by the main thread. To utilize the control in another thread, the delegation mechanism should be used. It's not so complicated. Here's a simple sample from codeproject.

http://www.codeproject.com/KB/cs/Cross_Thread.aspx

沒有留言:

張貼留言

乩童警探 一二集

接連看了兩集。第一集還算新鮮,到了第二集就看得比較慢了。一來,劇情雖然常會提到乩童,但真的跟乩童又沒有什麼關係。第二集後半大概就猜出是怎麼一回事了,但還是很享受在作者解釋的過程。只是前面舖陳有點久,而且人物有點多,再加上我是斷斷續續的看,看到後來都快忘了誰是誰,或是誰曾經出過什麼...