What is the use of Deployment.Current.Dispatcher.BeginInvoke( ()=> {…} )?

后端 未结 3 940
一个人的身影
一个人的身影 2020-12-15 18:53

I have seen this Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} ) format in some code .Is it used to do some work in Background?What are the general uses of it?

3条回答
  •  醉梦人生
    2020-12-15 19:50

    When code that updates the UI executes from a thread other than the UI thread, an invalid cross-thread access exception occurs.

    The dispatcher allows you to pass some code over to the UI thread from another thread.

    The project I put in this post demonstrates this, among other concepts.

    WebClient, HttpWebRequest and the UI Thread on Windows Phone 7

提交回复
热议问题