使用托管和非托管代码进行 Windows Embedded Compact 7 应用程序开发
我即将为带有运行 Windows Embedded Compact 7 的 nvidia Tagra2 的嵌入式设备编写一个应用程序。有以下要求:
- 使用安全的 HTTPS 通信通过 REST-API 从互联网服务器查询数据。
- 将此数据映射到对象模型。
- 在漂亮的嵌入式 Silverlight GUI 中显示这些对象。
- 使用外部传感器进行一些测量,并通过 REST-API 和安全 HTTPS 将测量数据传输到服务器。
我知道嵌入式 Silverlight 需要非托管 C++ 代码。但是仅仅因为嵌入式 Silverlight GUI 就用非托管 C++ 编写整个应用程序对我来说将是一场噩梦。因此,我想到了两种替代方案:
- 将逻辑放入托管 C# DLL 中,并从托管嵌入式 Silverlight GUI 的非托管 C++ 可执行文件访问它。
- 将嵌入式 Silverlight GUI 放入非托管 C++ DLL 中,并从托管其余逻辑并控制 GUI 的托管 C# 可执行文件访问它。
我的问题是:
- 上述替代方案之一是否可能?
- 哪一个更可取?我在 C# 方面比在 C++ 方面要好得多。
- 您能否向我指出涵盖上述替代方案之一的资源(书籍、教程、示例)?
I'm about to write an application for a embedded device with an nvidia Tagra2 running Windows Embedded Compact 7. There are the following requirements:
- Query data from an internet server via a REST-API using secured HTTPS communication.
- Map this data to an object model.
- Display these objects in a nice Embedded Silverlight GUI.
- Do some measurements with extern sensors and transmit the measured data to the server via the REST-API and secured HTTPS.
I know that Embedded Silverlight needs unmanaged C++ code. But writing the whole application in unmanaged C++ only because of the Embedded Silverlight GUI would be nightmare for me. So I think of two alternatives:
- Put the logic in a managed C# DLL and access it from the unmanaged C++ executable that hosts the Embedded Silverlight GUI.
- Put the Embedded Silverlight GUI in an unmanaged C++ DLL and access it from a managed C# executable hosting the rest of the logic and controling the GUI.
My questions are:
- Is one of the alternatives above even possible?
- Which one would be preferable? I'm a mouch better in C# than in C++.
- Could you point me to resources (books, tutorials, examples) covering one of the above alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
选项#2 绝对有效。看看这个网站:
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2010/WEM309
选项 #1 应该也是可能的,尽管尝试从非托管代码调用托管 DLL 似乎可能需要更多工作。
Option #2 definitely works. Have a look at this site:
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2010/WEM309
Option #1 should be possible as well, although it seems like it might be more work to try to call the managed DLL from the unmanaged code.