问题描述
限时送ChatGPT账号..我正在尝试在 Windows Phone 8 上使用 C++ 获取 CoreDispatcher
,以便我可以将工作项提交到 UI 线程 Dispatcher,以便我可以更新 UI 线程上的 UI 元素.但是,当我调用 CoreWindow::GetCurrentForThread()
时,我会返回 NULL
.在 文档 中,它指出WP8 支持此功能.只要我为当前窗口获取NULL
,我就无法从中获取当前的Dispatcher
;有谁知道如何在 WP8 上获取当前的 Dispatcher?
I'm trying to get the CoreDispatcher
in C++ on Windows Phone 8 so that I can submit work items to the UI thread Dispatcher so I can update UI elements on the UI thread. However, when I call CoreWindow::GetCurrentForThread()
, I get NULL
back. In the documentation it states that this is supported on WP8. As long as I'm getting NULL
for the current Window, I can't get the current Dispatcher
from it; does anyone know how to get the current Dispatcher on WP8?
推荐答案
我用过
await CoreApplication.Views.First().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
//your code here
});
这篇关于CoreWindow::GetCurrentForThread() 始终为 NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论