Windows Phone 8: access UI Dispatcher in C++ code

时光毁灭记忆、已成空白 提交于 2019-12-24 01:18:30

问题


I am working on an Windows Phone 8 Application that uses mixed C# for UI and C++ for the underlying backed. I have some instances where I need to run some C++ code on the UI dispatcher thread (IE GetGeopositionAsync()).

I have tried a method of making a callback from C++ to C# that runs in the UI thread and then calls a C++ method and runs:

auto window = Windows::UI::Core::CoreWindow::GetForCurrentThread();

However this is returning null. Is there any way for me to accomplish this?


回答1:


I had a similiar problem some days ago, as it has always returned null. I ended up using in WinRT. According to MSDN (1, 2) you should be able to use this in WP8 as well.

CoreApplication.MainView.CoreWindow


来源:https://stackoverflow.com/questions/17244857/windows-phone-8-access-ui-dispatcher-in-c-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!