我想将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);
}
请帮助我,谢谢!