Created
December 2, 2015 10:44
-
-
Save robinmanuelthiel/dd5de2215e98b634d250 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnActivated(IActivatedEventArgs args) | |
{ | |
base.OnActivated(args); | |
string infos = string.Empty; | |
// Get voice data | |
if (args.Kind == ActivationKind.VoiceCommand) | |
{ | |
var commandArgs = args as VoiceCommandActivatedEventArgs; | |
var speechRecognitionResult = commandArgs.Result; | |
var commandName = speechRecognitionResult.RulePath[0]; | |
switch (commandName) | |
{ | |
case "switchLightOn": | |
var room = speechRecognitionResult.SemanticInterpretation.Properties["room"][0]; | |
var status = speechRecognitionResult.SemanticInterpretation.Properties["status"][0]; | |
infos = room + "|" + status; | |
break; | |
} | |
} | |
// Prepare frame | |
Frame rootFrame = Window.Current.Content as Frame; | |
if (rootFrame == null) | |
{ | |
rootFrame = new Frame(); | |
rootFrame.NavigationFailed += OnNavigationFailed; | |
Window.Current.Content = rootFrame; | |
RestoreSavedSettings(); | |
} | |
// Navigate and pass information | |
rootFrame.Navigate(typeof(MainPage), infos); | |
Window.Current.Activate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment