In this blog, i’ll show you how to get you App PackageFamilyName in Windows 10 in C# Code without Store, because it’s not available yet for Windows 10
In Windows and Windows Phone, we used to get App PackageFamilyName from the Store by “Associating the App, and get the unique PFN of the App”
Why do i need PFN:
If you are intending to use communication between Apps, or using App Services, you’ll absolutely need the PFN to connect the App and Service you are using or whatever the scenario you are building.
Let’s Get Started:
- Open Visual Studio 2015 CTP, Create new project, select Windows 10 (Blank Template)
- Open MainPage.xaml.cs and these namespaces.
The first, because we will be using a class inside it called Package
and the second, to show MessageDialog.
- Then, in Public MainPage() add this code.
var currentPack = Package.Current;
var pfn = currentPack.Id.FamilyName;
new MessageDialog("PFN = " + pfn).ShowAsync();
This code to show the PFN in a Message Dialog using Package Class.
- Now, run the demo, and the PFN should appear in a Message Dialog as shown:
Now, you have got your App PFN, you can use it to connect to other App using App Services.
Here’s the Code Sample.
Feel free to contact me, if you face any problem.
In this blog post, we will walk through How to integrate your Windows/Windows Phone 8.1 apps to Windows 10 Apps (Universal App Platform).
“Writing for Windows 10, is writing for all devices.”
First of all, we will have to make some modifications in package.appxmanifest but, unfortunately there’s no tools in Visual Studio CTP and Windows 10 Developer Tools yet.
But, to solve this problem at the meanwhile, there’s a Powershell script is written to do most of work till the full version, and you can get this file from HERE.
After you download the Powershell file, unzip it and place unzipped folder in the C Drive.
And you can get these tools from HERE.
Now, Let’s Start 🙂
- Open your Win/WP 8.1 Project and Right Click the project and hit Open in File Explorer.
- Click File > Open command prompt > Open command prompt as shown:
- Then, write following command.
And hit Enter.
This will convert the .csproj to UAP and will update the package.appxmanifest
- Now, you will find your project migrated to UAP.
- Make some edits in package.appxmanifest by adding uap: before some capabilities and Application Extensions and Protocols like shown below:
- And if you are migrating Windows 8.1 App, Change the tile size like shown below:
- Before you run, you have to add some extensions to solve Platform Specific issues (e.g phone back button), Right Click References and then hit Add Reference > Universal App Platform > Extensions
Add: Windows Desktop Extension SDK and Windows Mobile Extension SDK
- Now, Run your App, you might face some issues in xaml like Phone Styles, change them to public style that could run in Windows 10 UAP.
- About the Charms, they are not existed anymore in Windows 10 with the same UI but, you should replace them with in-app UI for (Search – App Settings – Sharing).
And Here are some tips to put in your consideration while migrating to Windows 10:
- Don’t forget to add Reference to Platform Extension SDKs, if needed.
- Review conditional code (#if…) and convert to adaptive code where appropriate.
- Replace calls to deprecated APIs, if any.
- Replace references to undefined styles in XAML (as we mentioned above).
- Update code that integrates with Charms bar.
- Extend your UI to create a great, adaptive UI that works across multiple device families.(The most Important)
This was a very simple scenario for migrating you Win/WP 8.1 App to Windows 10.
Keep in mind, it’s still a preview 😉