Where are the Windows Phone APIs in Windows XAML Universal Portable Library?

丶灬走出姿态 提交于 2019-12-12 20:34:22

问题


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.

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;

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?


回答1:


Here are the Windows Runtime APIs equivalents of the APIs you mentioned:

  • Devices (Windows.Devices.*)
  • Networking (Windows.Networking.*)

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).

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).

EDIT (thanks @Romasz): Here is an MSDN page that should help you Migrating your Windows Phone 8 app to a Windows Runtime XAML app



来源:https://stackoverflow.com/questions/23821885/where-are-the-windows-phone-apis-in-windows-xaml-universal-portable-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!