public override bool Execute(SpeechRecognitionResult result, ICortanaRuntimeActions runtimeActions, IWorkbook workbook) { string folderName = this.SemanticInterpretation(this.folderKeyName, result); if (!string.IsNullOrWhiteSpace(folderName)) { var target = this.GetFolders(workbook).FirstOrDefault(f => f.Name.Equals(folderName, StringComparison.CurrentCultureIgnoreCase)); if (target != null) { runtimeActions.SelectFolder(target); return(true); } } return(false); }
public void TryHandleActivation(ICortanaRuntimeActions runtimeActions, IActivatedEventArgs args) { if (args.Kind != ActivationKind.VoiceCommand || !(args is VoiceCommandActivatedEventArgs)) { return; } VoiceCommandActivatedEventArgs commandArgs = (VoiceCommandActivatedEventArgs)args; SpeechRecognitionResult speechRecognitionResult = commandArgs.Result; string voiceCommandName = speechRecognitionResult.RulePath[0]; foreach (var command in this.commands) { if (voiceCommandName.Equals(command.CommandName, StringComparison.OrdinalIgnoreCase)) { command.Execute(speechRecognitionResult, runtimeActions, this.workbook); } } }
public abstract bool Execute(SpeechRecognitionResult result, ICortanaRuntimeActions runtimeActions, IWorkbook workbook);