我正在尝试将 Cortana 集成到我的 UWP 中。第一步是“安装”VCD 文件。以下代码段在 Windows 10 上运行良好,但在部署到 Xbox 时会导致错误。具体来说,“installCommandDefinitionsFromStorageFileAsync”是失败的。有没有其他方法可以在 Xbox 上安装 VCD?或者,这是一个尚未修复的错误吗?
return wap.current.installedLocation.getFileAsync("vdmvoicecommands.xml").then(function (file) {
return voiceCommandManager.installCommandDefinitionsFromStorageFileAsync(file);
}, function (er) {
console.error('error file vdmvoicecommands.xml', er);
}).then(function () {
var language = window.navigator.userLanguage || window.navigator.language;
var commandSetName = "VDM_" + language.toLowerCase();
var commansets = Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.installedCommandDefinitions;
if (commansets.hasKey(commandSetName)) {
console.log("VCD loaded !");
} else {
console.log("VCD not installed yet?");
}
}, function (ee) {
console.warn("installCommandDefinitionsFromStorageFileAsync error", ee);
});