注册的语音控制定义文件似乎不起作用
本文关键字:不起作用 文件 定义 语音 控制 注册 | 更新日期: 2023-09-27 18:17:44
我在我的c# Windows 10通用应用程序中注册了以下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>
我在onlaunching注册,按照微软的指示。
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());
}
我试着说话和输入命令,但没有运气。它会立即执行必应搜索,而不会暂停。
尼克。好吧,我明白了,我的语言是错误的,因为我在这台电脑上有英语(United Kingdom),语言应该是"en-gb"而不是"en-us"