我们可以从桌面应用程序和Windows Phone 8应用程序访问Windows 8 WinRT API吗?如果是这样,它们是否在不同的命名空间中? [英] Can we access Windows 8 WinRT API from desktop application and Windows Phone 8 app? If so, are they in different namespaces?

查看:58
本文介绍了我们可以从桌面应用程序和Windows Phone 8应用程序访问Windows 8 WinRT API吗?如果是这样,它们是否在不同的命名空间中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着时间的流逝,我在此区域的博客上收到了许多评论.提出了许多问题,例如可以从桌面应用程序使用WinRT吗?",可以从.NET应用程序使用WinRT吗?",可以从.NET应用程序使用WinRT吗?".等等?如果可以,怎么办?

Over the course of time I received a number of comments on my blog in this area. Many questions were asked like "Can you use WinRT from Desktop applications?", "Can you use WinRT from .NET applications?", "Can you use WinRT from .NET applications?" etc? If so, how?

推荐答案

是的,您可以并且有关更多信息,请参考

Yes, you can and for more information refer to http://kishore1021.wordpress.com/2012/08/14/can-you-use-windows-8-winrt-api-from-net-desktop-applications/

要设计此类应用程序,最好的方法是开发可移植类库并访问可在桌面,商店和电话应用程序中使用的API.通过这种设计,您无需为每个设备重写业务逻辑代码.有关PCL的详细信息,请参见 http: //channel9.msdn.com/Shows/This+Week+On+Channel+9/TWC9-August-10-2012

Coming to architecting such applications, the best way to go forward is to develop a Portable Class Library and access the API's that can be used from Desktop, Store and Phone apps. By this kind of design, you don't rewrite the business logic code for each device. For detailed information on PCL, see http://channel9.msdn.com/Shows/This+Week+On+Channel+9/TWC9-August-10-2012

在Metro风格应用程序中可以使用的Win32和COM API的子集在Windows软件开发工具包(SDK)的Metro风格应用程序的头文件中指出.在头文件中查找以下语句:

The subset of the Win32 and COM API that can be used in a Metro style app is indicated in the header files in the Windows Software Development Kit (SDK) for Metro style Apps. Look for the following statements in the header files:

#pragma region Application Family

#pragma region Desktop Family

这篇关于我们可以从桌面应用程序和Windows Phone 8应用程序访问Windows 8 WinRT API吗?如果是这样,它们是否在不同的命名空间中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆