【发布时间】:2013-09-25 09:50:11
【问题描述】:
我是 WP8/c# 的新手,被新信息超载,并且肯定遗漏了一些东西。
我有使用本机代码库的 wp8 应用程序。我如何通知 UI 有关本机代码的更改? 我知道我不能将回调从 c# 函数传递到 wp8 上的本机 c++。 下面的简单代码说明了我想要什么:
主页 cs
namespace phoneapp
{
public partial class MainPage : PhoneApplicationPage
{
testRT _testrt;
public MainPage()
{
_testrt= new testRT();
}
private void btnTest_Click(object sender, RoutedEventArgs e)
{
_testrt->foo();
}
}
}
运行时组件 cpp
namespace rtc
{
public ref class testRT sealed
{
public:
testRT();
void foo();
private:
test* _test;
};
}
testRT::testRT()
{
_test= new test();
}
testRT::foo()
{
_test->foothread();
}
原生类 cpp
test::test()
{
}
test::~test()
{
}
void test::foothread()
{
signal_UI_status("started");
while (notfinished)
{
//do something
...
signal_UI_results("found %i results", res);
}
signal_UI_status("finished");
}
在 windows phone 上实现这种“信号”功能的最佳方式是什么?打回来?命名管道?插座?
【问题讨论】:
-
Howto implement callback interface from unmanaged DLL to .net app? 的可能重复项 - 可能有更好的匹配,但这已被问过很多次,在 c++/c#/callback 上搜索会发现很多噪音
-
嗯,不完全是——它不是 .net 应用程序:windows phone 8 通过 c++/cx 中的 windows phone 运行时组件使用本机库
标签: c# c++ windows-phone-8