C#将DispatcherObject从.Net Framework 4.5替换为.Net Core 2.1

时间:2019-05-10 10:05:23

标签: c# .net-core-2.1

我想将DispatcherObject从.Net Framework 4.5替换为.Net Core 2.1。

我可以使用其他课程来实现吗?

作为参考,我在.Net Framework 4.5中的代码如下:

// If the subscriber is a DispatcherObject and different thread.
DispatcherObject dispatcherObject = handler.Target as DispatcherObject;

if (dispatcherObject != null && !dispatcherObject.CheckAccess())
{
    // Invoke handler in the target dispatcher's thread... 
    // asynchronously for better responsiveness.
    dispatcherObject.Dispatcher.BeginInvoke(DispatcherPriority.DataBind, handler, this, e);
}
else
{
    // Execute handler as is.
    handler(this, e);
}

请帮助我,谢谢!

0 个答案:

没有答案