Windows XAML 通用便携式库中的 Windows Phone API 在哪里? [英] Where are the Windows Phone APIs in Windows XAML Universal Portable Library?
问题描述
我有一个适用于 Windows Phone 8.0 和 Windows 8 的库,并打算制作相同的库以支持 Windows Phone 8.1 和 Windows 8.1 通用应用程序.
I have a library for Windows Phone 8.0 and Windows 8 and thought to make the same to support the Windows Phone 8.1 and Windows 8.1 Universal applications.
但是当我尝试将我的代码移植到通用 XAML 库中时,或者甚至在使用我所看到的模板创建的 Windows Phone 8.1 通用应用程序中尝试某些 API 时,例如,
But soon as I tried to port my code in a Universal XAML library or even when trying some APIs in a Windows Phone 8.1 Universal Application that is created using the template I've seen that are missing, for example,
using Microsoft.Phone.Info;
using Microsoft.Phone.Net.NetworkInformation;
或者我在 App.xaml.cs 文件中使用 PhoneApplicationFrame 类,RootFrame,该文件现在发生了巨大变化.
Or I was using the PhoneApplicationFrame class, RootFrame in the App.xaml.cs file that is now too changed dramatically.
在哪里可以找到这些命名空间以获取与设备相关的信息?
Where do I find these namespaces to get information related to the device?
推荐答案
以下是您提到的 API 的等效 Windows 运行时 API:
Here are the Windows Runtime APIs equivalents of the APIs you mentioned:
请注意,您不会有 1:1 的等价物.您将可以使用新功能,但会缺少其他功能(例如:Battery API).
Please not that you won't have 1:1 equivalent. You'll have access to new functionality but other will be missing (example : the Battery API).
关于PhoneApplicationFrame
中的变化,您不应该尝试将 Silverlight 模型(导航、框架系统...)适应新的 Universal 模型.相反,我建议使用默认项目模板并使用该模型(使用像 NavigationHelper
和 SuspensionManger
这样的 Helper 类).
About the changes in the PhoneApplicationFrame
, you shouldn't try to fit the Silverlight model (navigation, frame system...) into the new Universal one. Instead, I recommend to use the default project template and use that model (with the Helper classes like NavigationHelper
and SuspensionManger
).
编辑(感谢@Romasz):这是一个 MSDN 页面,可以帮助您将您的 Windows Phone 8 应用程序迁移到 Windows 运行时 XAML 应用程序
EDIT (thanks @Romasz): Here is an MSDN page that should help you Migrating your Windows Phone 8 app to a Windows Runtime XAML app
这篇关于Windows XAML 通用便携式库中的 Windows Phone API 在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!