Flycoder

Flying with codes

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

1.
System.ComponentModel.ISynchronizeInvoke interface.
Control.Invoke, Control.BeginInvoke. 
 How can it implement.
 1). it makes delegate as message by mashal mechanism.
 2). This message will be invoked by Win32 using it's message mechanism.
InquireInvoke
 FALSE not UI thread, so need to invoke the Invoke method.
2.
Backgroundwork
 it will give the control to UI thread.
 there are some events you can register. DoWork, ReportProcess, Completed

3.
Thread.IsBackGround.
 When we set thread is background, the application can be close without waiting this thread to finish,
 otherwise the application can not be closed until the thread finish.

4.
System.Timers.Timer.SynchronizingObject
 When SynchronizingObject is null, the method that handles the Elapsed event is called on a thread from the system-thread pool. For more information on  system-thread pools, see ThreadPool.

 When the Elapsed event is handled by a visual Windows Forms component, such as a button, accessing the component through the system-thread pool might result in an exception or just might not work. Avoid this effect by setting SynchronizingObject to a Windows Forms component, which causes the method that handles the Elapsed event to be called on the same thread that the component was created on.

posted on 2011-03-30 11:15  flycoder  阅读(170)  评论(0)    收藏  举报