1

有没有办法用 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 文件被注册,我只能使用其中之一的语音命令。

4

0 回答 0