我在我的c#Windows 10 Universal应用程序中注册了以下VCD.xml文件,但我不能让Cortana回复它们,它只是每次Bing搜索。
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
<CommandSet xml:lang="en-us" Name="UniversalAppCommandSet_en-us">
<AppName> Spang </AppName>
<Example> Tell me the time </Example>
<Command Name="TellTime">
<Example> tell me the time </Example>
<ListenFor RequireAppName="BeforeOrAfterPhrase"> tell me the time </ListenFor>
<Feedback> Getting the time for you. </Feedback>
<Navigate/>
</Command>
</CommandSet>
</VoiceCommands>
根据微软的指示,我正在注册OnLaunched。
try
{
// Install the main VCD.
StorageFile pSFeVCD = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/VCD.xml"));
await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(pSFeVCD);
System.Diagnostics.Debug.WriteLine("Successfully installed voice commands.");
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Installing Voice Commands Failed: " + ex.ToString());
}
我正在尝试说话并输入命令,但没有运气。它会立即执行Bing搜索而不会暂停。
尼克。
答案 0 :(得分:0)
好吧我明白了,我的语言不正确,因为我在这台电脑上有英语(英国),语言应该是“en-gb”而不是“en-us”。