加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-8 – 使用WinRT API编写的应用程序是否可以在Windows 8

发布时间:2020-12-14 04:38:05 所属栏目:Windows 来源:网络整理
导读:AFAIK,只有Metro风格的应用程序可以在 Windows 8 ARM上运行,而Metro风格的应用程序只能使用WinRT API编写. 根据这个帖子Can we access Windows 8 WinRT API from desktop application and Windows Phone 8 app? If so,are they in different namespaces? Win
AFAIK,只有Metro风格的应用程序可以在 Windows 8 ARM上运行,而Metro风格的应用程序只能使用WinRT API编写.

根据这个帖子Can we access Windows 8 WinRT API from desktop application and Windows Phone 8 app? If so,are they in different namespaces?

Windows Phone 8也使用ARM体系结构.因此,如果我们的应用程序是使用WinRT API编写的,它可以在Windows 8 x86,Windows 8 for ARM和WP8上运行,对吧?

解决方法

不完全是. WinRT和Windows Phone Runtime的情况类似于WPF / Silverlight.有重叠,但不是100%覆盖.为解决此问题,Microsoft鼓励使用可移植类库来定位多个平台(因为每个平台都有自己的运行时).有关PCL的更多信息: http://msdn.microsoft.com/en-us/library/gg597391.aspx

此外,即使您设法让大多数类在可移植类库下工作,您仍然必须为每个平台编写单独的用户界面(PCL不支持共享UI).虽然这看起来很令人沮丧,但它实际上比你想象的更为必要.这是微软在共享XAML UI方面所建议的link.

This shouldn’t be seen as a complete roadblock for sharing between
Windows Phone 8 and Windows 8. The clear guidance is to design and
build your UI separately for each platform,embracing the design
guidelines for each. It is technically possible to circumvent these
obstacles. You could create your UI during page initialization from
code. You could load platform-specific XAML from resources at runtime
and inject it as a string into the page. However,none of these
techniques scale and they make the construction of your core asset—how
your app looks to your user—a tedious and error-prone task. Your code
sharing investment will give you a much larger return further down
your app stack,by trying to share app logic,data models,viewmodels,
etc.

基本上,微软正在设计专门针对平台的用户界面,因为在手机上运行的应用程序(小屏幕)应该具有与在平板电脑/台式机(大屏幕)上运行的应用程序不同的用户界面.

至于在不同平台上运行WinRT应用程序……是的,你可以.微软已声明用WinRT编写的应用程序可以在Windows 8和WOA(Windows on ARM)上运行.这是来自微软的link谈论这个.但是,我的答案的第一部分仍然存在……如果你想针对不同的运行时(WinRT / Windows Phone Runtime)……那么使用Portable Class Libraries.选择“Windows Store”和“Windows Phone 8”将允许您的代码在Windows 8 x86 / x64 / ARM和Windows Phone 8上运行.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读