使用Cortana注册多个语音命令定义文件

时间:2017-08-09 05:02:30

标签: uwp cortana vcd

有没有办法用Cortana注册多个语音命令定义文件 UWP?

我有一个响应自定义cortana命令的应用程序。由于我的应用程序将响应的命令数量很大,我想将它们分成多个VCD文件。我希望我的应用程序能够响应每个VCD文件中指定的不同CommandPrefix。

示例VCD文件1:

<CommandSet xml:lang="en-us" Name="CustomCommands">
    <CommandPrefix>Custom</CommandPrefix>
    <Example> Open Website </Example>

    <Command Name="CustomOpenWebsite">
    <Example> Open website </Example>          
    <ListenFor> Open website </ListenFor>
    <Feedback> Opening your website </Feedback>
    <Navigate/>          
    </Command>
</CommandSet>

示例VCD文件2:

<CommandSet xml:lang="en-us" Name="ReportCommands">
    <CommandPrefix>My report</CommandPrefix> 
    <Example> Open Report </Example>

    <Command Name="OpenReport">
      <Example>[Can] [you] Open [the] report [please]</Example>
      <ListenFor> Open report </ListenFor>
      <Feedback> Opening your report </Feedback>
      <Navigate/>
    </Command>
<CommandSet>

我正在注册这两个VCD文件

StorageFile vcdReport = await Package.Current.InstalledLocation.GetFileAsync(@"ReportCommandDefinitions.xml");
StorageFile vcdCustom = await Package.Current.InstalledLocation.GetFileAsync(@"CustomCommandDefinitions.xml");

await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdCustom);
await VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdReport);

但是,这似乎不起作用。只有一个VCD文件被注册,我只能使用其中一个的语音命令。

0 个答案:

没有答案
相关问题