简体   繁体   中英

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

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM