Skip to content

Instantly share code, notes, and snippets.

@beramode
Created December 25, 2014 02:49
Show Gist options
  • Save beramode/e3b07210e872c332d8ec to your computer and use it in GitHub Desktop.
Save beramode/e3b07210e872c332d8ec to your computer and use it in GitHub Desktop.
//winform
//在不同執行續下想要呼叫前端物件時可以使用invoke()來切換當前執行續
control.invoke()
//使用invoke()是同步執行,執行完invoke()中程式內容後才會接著執行下面的程式
control.BeginInvoke()
//使用BeginInvoke()是非同步執行,兩邊程式都會一起執行
control.EndInvoke()
//在使用BeginInvoke()後,使用EndInvoke(),則程式會停在這裡,等待BeginInvoke()的內容執行完成
//wpf
control.Dispatcher.Invoke()
//其實跟winform差不多,就是多了Dispatcher
control.Dispatcher.BeginIvoke()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment