MS Champs meetup may 2014 on Cortana.
-
Upload
isham-mohamed-iqbal -
Category
Technology
-
view
334 -
download
2
Transcript of MS Champs meetup may 2014 on Cortana.
Thanks all for voting
#StopDengue
We all know about Cortana
She does•Call Hubby, mobile
•Text Hubby hi sweety
•Change my 3 pm appointment to 4
•Next time I’m at the Microsoft, remind me to
meet Wela
•Take note: left my car on level 4
•Wake up me in 20 minutes
•Play Hariharan
•Find cheap pizza restaurant near me
•Do I need an umbrella
“Take note: left my car on level 4”
Where does the note go?
Boooorrrrring !!
Old stories
ENOUGH!
OK...!Lets
HACK
The <big>IDEA</big>
Everyone knows
Only hackers know
Confusing?
EXAMPLE scenario
Me : Set colour to RedCortana : Setting colour to Red[Win 8 & WP apps shows Red colour background]
Me : Set colour to BlueCortana : Settings colour to Blue[Win 8 & WP apps shows Red colour background]
REAL LIFE scenarioMe : Switch on bulb 1Cortana : Switching bulb 1 on[One bulb in the room gets light]
Me : Switch off bulb 1Cortana : Switching bulb 1 off[One bulb in the room gets off from light]
Me : Switch off bulb 1Cortana : YAKO!! Its already off
Real life IDEA
Fly balloons with CORTANA
Lets
/build//
/build//
Voice Command
Easy
3 steps
Create Voice Command Definition(s)
Register VCD XML on App Startup
Handle Voice Command Activation
Refer:http://channel9.msdn.com/Events/Build/2014/2-530
<?xml version="1.0" encoding="utf-8"?><VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
<CommandSet xml:lang="en-us" Name="englishCommands"> <CommandPrefix>MSDN</CommandPrefix> <Example>How do I add Voice Commands to my application</Example> <Command Name="FindText"> <Example>Find Install Voice Command Sets</Example> <ListenFor>Search</ListenFor> <ListenFor>Search for {dictatedSearchTerms}</ListenFor> <ListenFor>Find</ListenFor> <ListenFor>Find {dictatedSearchTerms}</ListenFor> <Feedback>Search on MSDN</Feedback> <Navigate Target="MainPage.xaml" /> </Command> <Command Name="nlpCommand"> <Example>How do I add Voice Commands to my application</Example> <ListenFor>{dictatedVoiceCommandText}</ListenFor> <Feedback>Starting MSDN...</Feedback> <Navigate Target="MainPage.xaml" /> </Command> <PhraseTopic Label="dictatedVoiceCommandText" Scenario="Dictation"> <Subject>MSDN</Subject> </PhraseTopic> <PhraseTopic Label="dictatedSearchTerms" Scenario="Search"> <Subject>MSDN</Subject> </PhraseTopic> </CommandSet> </VoiceCommands>
private async void RegisterVoiceCommands(){ // SHOULD BE PERFORMED UNDER TRY/CATCH Uri uriVoiceCommands = new Uri("ms-appx:///vcd.xml", UriKind.Absolute)); await VoiceCommandService.InstallCommandSetsFromFileAsync(uriVoiceCommands);
// Please note that VoiceCommandService ends with WP8.1 (End of Silverlight era) // (ie) No more .xap’s after WP8.1. Only .appx’s}
Windows Phone Silverlight Apps on Windows Phone 8.1
Windows Runtime Apps on Windows Phone 8.1
private async void RegisterVoiceCommands(){ // SHOULD BE PERFORMED UNDER TRY/CATCH Uri uriVoiceCommands = new Uri("ms-appx:///vcd.xml", UriKind.Absolute); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands); await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file); // No need to define Capabilities in app manifest}
VCD Commands and Targets
YourPage.xamlSYSTEM
Silverlight App
System launches app on page specified by Target
Page code maps commands (intents) into actions
// Windows Phone Silverlight App, in MainPage.xaml.cs
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e){ base.OnNavigatedTo(e);
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New) { string recoText = null; // What did the user say? e.g. MSDN, "Find Windows Phone Voice Commands" NavigationContext.QueryString.TryGetValue("reco", out recoText);
string voiceCommandName = null; // Which command was recognized in the VCD.XML file? e.g. "FindText" NavigationContext.QueryString.TryGetValue("voiceCommandName", out voiceCommandName);
string searchTerms = null; // What did the user say, for named phrase topic or list "slots"? e.g. "Windows Phone Voice Commands" NavigationContext.QueryString.TryGetValue("dictatedSearchTerms", out searchTerms);
switch (voiceCommandName) // What command launched the app? { case "FindText": HandleFindText(searchTerms); break;
case "nlpCommand": HandleNlpCommand(recoText); break; } }}
VCD Commands and Targets
SYSTEMApp class
YourPage.xaml
Windows Runtime App
System tells code in App class what command and target were used
Code in App class navigates to page
Page code maps commands (intents) into actions
// Windows Runtime App on Windows Phone 8.1, inside OnActivated override in App class
if (args.Kind == ActivationKind.VoiceCommand){ VoiceCommandActivatedEventArgs vcArgs = (VoiceCommandActivatedEventArgs)args;
string voiceCommandName = vcArgs.Result.RulePath.First(); // What command launched the app?
switch (voiceCommandName) // Navigate to right page for the voice command { case "FindText": // User said "find" or "search" rootFrame.Navigate(typeof(MSDN.FindText), vcArgs.Result); break;
case "nlpCommand": // User said something else rootFrame.Navigate(typeof(MSDN.NlpCommand), vcArgs.Result); break; }}
/build//
Bluetoothpairing
Refer :http://blogs.msdn.com/b/flecoqui/archive/2013/12/13/windows-store-and-windows-phone-app-to-app-communication-over-bluetooth.aspx
“Cortana, recharge mom’s
mobile with 50 rupees”
Good exampleDialog eWallet
eZ charging API - Charge the cost of digital goods
eZ Cash API - transfer funds between two eZ Cash wallets and check
the transaction history.
http://1drv.ms/RucQqc
http://1drv.ms/RucQqc