Migrate your Win/WP 8.1 Apps to Windows 10 (UAP)

Win10_Windows_ProductFamily_Web

 

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 🙂

  1. Open your Win/WP 8.1 Project and Right Click the project and hit Open in File Explorer.
  2. Click File > Open command prompt > Open command prompt as shown:
  3. Then, write following command.
    C:\ProjectUpgradeUtility\Run_UpgradetoUAP_Powershell_script.bat
    And hit Enter.
    CMD
    This will convert the .csproj to UAP and will update the package.appxmanifest
  4. Now, you will find your project migrated to UAP.
  5. Make some edits in package.appxmanifest by adding uap: before some capabilities and Application Extensions and Protocols like shown below:
    appxmanifest
  6. And if you are migrating Windows 8.1 App, Change the tile size like shown below:
    Win8.1 Tile size
  7. 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
    Extensions
  8. 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.
  9. 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 😉

Integrating Cortana | Part 3

Cortana

In the two previous blog posts, you should be finished of the first two steps of integrating Cortana.

So, in this blog post, you will perform the last step of integrating Cortana and the most important one which is How to Handle the voice commands.

What we did in the two past blog posts is:

  1. We Created the VCD file which contains the Voice Commands Which the user should say to Cortana.
  2. Then, we registered this VCD file on App Startup to let the System/Cortana recognize which command is activated by the user later.

And Now, we will walk through How to Handle the Voice Command when the user Activate it by saying it to Cortana,  in other words, What the action should be performed when the user say a specific Command. Continue reading

Integrating Cortana | Part 2

Cortana

Integrating Cortana | Part 1

In the previous blog post, we have already demonstrated How to Integrate Cortana through Three easy steps and we walked through the First Step “Create Voice Command Definition File”.
In this blog post, we will walk through the Second Step “Register VCD xml file on App Startup”.

2. Register VCD xml file on App Startup

After Creating the Voice Command Definition File, we have to register this file on App Startup to let the Phone System and Cortana able to Recognize these Commands.

To Register the VCD File:

  1. Open App.xaml.cs
  2. Add this snippet of code in OnLaunced Method

    Uri uriVoiceCommands = new Uri("ms-appx:///vcd.xml", UriKind.Absolute);
    
    StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);
    
    await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
    

    And this code should be performed under Try/Catch to Handle Exception Errors.

Continue reading

Integrating Cortana | Part 1

CortanaIn this blog, you will learn How to integrate Cortana into your Windows Phone 8.1 Runtime App.
But, before you integrate Cortana, you have to know Who is Cortana?
So, let me introduce Cortana to you, or actually she will 😀

Who is Cortana?

Cortana is your Digital Personal Assistant, it was developed by Microsoft for Windows Phone 8.1, Microsoft Band and it will be available in Windows 10.
Cortana was announced for the first time at Microsoft BUILD Developer Conference April 2014 and before that she was a character in Halo video game series.

If you have a Windows Phone Device, try asking Cortana “Who are you?” and “Tell me more about yourself.” 😉

Cortana’s Core Functions

Cortana has Three Core Functions:

  1. Communicate
    It can make a call, send text message and text dictation task and so on.
  2. Reminder
    Help the user complete the task now, or help them remember for later.
  3. Find
    Finding content in large catalogs, from large lists, etc…

What can Cortana do?

If you have a Windows Phone Device, try asking Cortana the below commands between the double quotations. Continue reading

App Bar, Rate and Share

In this blog post, you will learn the following:wp_ss_20150316_0001

  • Add App Bar (XAML)
  • Add Rate and Review Button in your App
  • Add more apps Button “related to you on the store”
  • Add App details Button
  • Add Share Button

Let’s get started 😉

Add App Bar (XAML)

  1. Open Visual Studio, Create new project (Windows Phone 8.1 > Blank Template).
  2. In Solution Explorer, Open MainPage.xaml and Add this code outside the main Grid:
    AppBar

Now, you have been created an App Bar but, we need to handle these AppBarButtons 😀

Add Rate and Review Button

In Solution Explorer, Open MainPage.xaml.cs and Add this code in RateBtn_Click event handler:

await Launcher.LaunchUriAsync
 (new Uri("ms-windows-store:reviewapp?appid=" + Windows.ApplicationModel.Store.CurrentApp.AppId));

Add More Apps Button

This button navigates to related apps in the store, maybe other apps for you in the store or any related apps to you using a keyword in store search bar.

Add this code in moreAppsBtn_Click event handler:

string keyword = "Mohammed Emam";
var uri = new Uri(string.Format(@"ms-windows-store:search?keyword={0}", keyword));
await Windows.System.Launcher.LaunchUriAsync(uri);

Add App Details Button

This button navigates to your app details page on the store.

Add this code in detailsBtn_Click event handler:

var uri = new Uri(string.Format("ms-windows-store:navigate?appid={0}", Windows.ApplicationModel.Store.CurrentApp.LinkUri));
await Windows.System.Launcher.LaunchUriAsync(uri);

Add Share Button

This button will share your app’s link.

Add this Method in MainPage.xaml.cs



private void RegisterForShare()
 {
     DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
     dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager,
     DataRequestedEventArgs>(this.ShareLinkHandler);
 }

private void ShareLinkHandler(DataTransferManager sender, DataRequestedEventArgs e)
 {
     DataRequest request = e.Request;
     request.Data.Properties.Title = "Title";
     request.Data.Properties.Description = "Description";
     request.Data.SetWebLink(new Uri(""+ Windows.ApplicationModel.Store.CurrentApp.LinkUri));
 }


Then, call this method in shareBtn_Click event handler and add this line of code:

RegisterForShare(); //Calling the method
 DataTransferManager.ShowShareUI();

 

Download the entire code sample from HERE

Azure Mobile Services – Facebook Authentication

In this blog post, we will demonstrate how to use Azure Mobile Services Authentication and will choose Facebook Authentication as an Example and apply this on Windows Phone 8.1 Runtime App.

First of all you will need:

  • Azure Account.
  • Facebook account, and sign up as a developer.
  • Visual Studio (2013 Update 2 or above).

Let’s Get Started: Continue reading