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.

Now, you have already Created your Voice Command Definition File and Registered this file on your App Startup.

Go to the Next step:
Integrating Cortana | Part 3

Advertisements

2 thoughts on “Integrating Cortana | Part 2

  1. Pingback: Mohamed Emam | Integrating Cortana | Part 1

  2. Pingback: Mohamed Emam | Integrating Cortana | Part 3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s