Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} ) 有什么用? [英] What is the use of Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} )?

查看:23
本文介绍了Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} ) 有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一些代码中看到过这种Deployment.Current.Dispatcher.BeginInvoke(()=> {...})格式.它是用来做一些后台工作的吗?它的一般用途是什么?

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?

推荐答案

不,不是在 后台 线程中工作 - 而是在 UI 上工作线.所以它通常从后台线程调用,以便操作 UI,而这只能在 UI 线程上完成.

No, it's not to do work in a background thread - it's to do work on the UI thread. So it's normally called from a background thread, in order to manipulate the UI, which can only be done on the UI thread.

lambda 表达式的主体是您要在 UI 线程中执行的代码.

The body of the lambda expression is the code which you want to execute in the UI thread.

这篇关于Deployment.Current.Dispatcher.BeginInvoke( ()=> {...} ) 有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆