In .NET you have System.Threading.Thread.IsBackground.
Is there some equivalent of this in WinRT/Metro?
I have a method which changed UI properties, and I want to determine whether or not I need to dispatch the execution to the UI thread runtime.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, if you use MVVM Light Toolkit in your app, you can use CheckBeginInvokeOnUI(Action action) method of GalaSoft.MvvmLight.Threading.DispatcherHelper class which handles this situation automatically.
Edit:
The following code is based on DispatcherHelper class of MVVM Light Toolkit – link
But if you don’t want to use MVVM Light (which is pretty cool thing by the way), you can try something like this (sorry, can’t check if this works, don’t have Windows 8):
It would be nicer to put this logic in separate class like this:
Then you can use it like: