Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Silverlight, how do you find out whether the code is running in the UI thread or not?

Basically I need to know whether I need to can Dispatcher.BeginInvoke or if it's not needed.

Thanks.

like image 707
rui Avatar asked Jan 11 '10 13:01

rui


1 Answers

You can use the Dispatcher.CheckAccess method. It returns true if you're on the same thread as the UI dispatcher, and false otherwise

like image 94
Thomas Levesque Avatar answered Oct 05 '22 06:10

Thomas Levesque