gpt4 book ai didi

.net - 在 Silverlight 中,如何调用主调度线程上的操作?

转载 作者:行者123 更新时间:2023-12-03 12:44:06 25 4
gpt4 key购买 nike

在 WinForms UserControl 中,我将通过从任何控件的方法调用 this.BeginInvoke() 将数据传递到主 GUI 线程。 Silverlight UserControl 中的等价物是什么?

换句话说,我如何获取任意工作线程提供的数据并确保它在主调度线程上得到处理?

最佳答案

使用 UserControl 类上的 Dispatcher 属性。

private void UpdateStatus()
{
this.Dispatcher.BeginInvoke( delegate { StatusLabel.Text = "Updated"; });
}

关于.net - 在 Silverlight 中,如何调用主调度线程上的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/222688/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com