Comment extraire l’argument d’une commande Cortana avec un sujet de phrase, activé via du texte?

Haut niveau:

Je souhaite utiliser ma commande personnalisée Cortana “Bloc-notes” en mode TEXTE . Par exemple, en appuyant sur WIN + S et en tapant “Exemple de bloc-notes appname!”.
(Ceci ouvrira le Bloc-notes et introduira “Exemple de phrase!”.)

La commande Notepad fonctionne déjà en mode VOICE : lorsque j’appuie sur WIN + C et que je prononce “appname Exemple de bloc-notes phrase!”, Mon script de bloc-notes s’exécute avec la charge utile “Exemple de phrase!”.

Le problème:

Lorsque j’appuie sur WIN + S et que je saisis “appname Exemple de phrase!”, La propriété textuelle de SpeechRecognitionResult est “Bloc-notes …” (par opposition à voice où elle est “Phraseep Exemple de Bloc!”, Comme prévu).

Code:

Extrait VCD.xml

  Notepad Example Sentence!   Notepad {wildcardArgs}   Notepadding {wildcardArgs}     <!--Wildcard-->  

CommandHandler.cs

 public static CortanaCommand ProcessCommand(SpeechRecognitionResult speechRecognitionResult, CommandDiagnostics diagnostics) { // Get the name of the voice command and the raw text ssortingng voiceCommandName = speechRecognitionResult.RulePath[0]; ssortingng text = speechRecognitionResult.Text; ssortingng mode = speechRecognitionResult.SemanticInterpretation.Properties[interpretationKey].FirstOrDefault(); // When mode is voice, text is "Notepad Example sentence!" // When mode is text, text is "Notepad ..." // How can one resortingeve "Example sentence!" from "..." !? // Is there some property other than speechRecognitionResult.Text that holds the raw text typed? ssortingng argument = null; CortanaCommand processedCommand = null; switch (voiceCommandName) { // ... case CortanaCommand.Notepad: const ssortingng notepad = "Notepad"; argument = CortanaCommand.SsortingpOffCommandName(notepad, text); processedCommand = new NotepadCortanaCommand(argument, diagnostics); break; default: Debug.WriteLine("Command Name Not Found: " + voiceCommandName); break; } return processedCommand; } 

Question reformulée

Comment le code ci-dessus peut-il être modifié pour extraire les arguments de commande (c’est-à-dire tout autre que le nom de l’application et le nom de la commande) en mode texte?

 case CortanaCommand.Notepad: argument = speechRecognitionResult.SemanticInterpretation.Properties["wildcardArgs"].FirstOrDefault(); // the magic line ^ processedCommand = new NotepadCortanaCommand(argument, diagnostics); break;