2016-12-22 2 views
0

VCDファイルUWP installCommandDefinitionsFromStorageFileAsyncインストールすることはできません。私は私のアプリ(WinjsとUWP)にコルタナを統合するが、私はVCDファイルをインストールしようとすると、私はそのエラーだ

Status is 'error', but getResults did not return an error 

main.jsを(コードは上のラップされていますアプリケーションの起動ハンドライベント):

wap.current.installedLocation.getFileAsync("Commands.xml").then(function (file) { 
    return voiceCommandManager.installCommandDefinitionsFromStorageFileAsync(file); 
}, function (er) { 
    console.error('error file Commands.xml', er); 
}).then(function() { 
    var language = window.navigator.userLanguage || window.navigator.language; 

    var commandSetName = "BibleCommandSet_" + language.toLowerCase(); 
    if (voiceCommandManager.installedCommandDefinitions.hasKey(commandSetName)) { 
     var vcd = voiceCommandManager.installedCommandDefinitions.lookup(commandSetName); 
    } else { 
     console.log('VCD not installed yet?'); 
    } 
}, function (ee) { 
    console.error("installCommandDefinitionsFromStorageFileAsync error", ee); 
}); 

Commands.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2"> 
    <CommandSet xml:lang="en-us" Name="BibleCommandSet_en-us"> 
     <AppName> Bible </AppName> 
     <Example> Go to genesis 1,9 </Example> 
     <Command Name="goToQuote"> 
      <Example> Go to genesis 1,9 </Example> 
      <ListenFor RequireAppName="BeforeOrAfterPhrase"> show {book} {number}</ListenFor> 
      <ListenFor RequireAppName="BeforeOrAfterPhrase"> show {book} {number}{number}</ListenFor> 
      ... 
      <ListenFor RequireAppName="BeforeOrAfterPhrase"> open {book} {number}{number},{number}{number}</ListenFor> 
      <Feedback> Ok i'm opening {book} </Feedback> 
      <Navigate/> 
     </Command> 
    </CommandSet> 

修正:をファイルの別の行に、私は別のコマンドセットを持っていると私はPhraseList「ブック」と呼んでいたましたが、本当の名前は「リブロ」だった

答えて

0

I integrating Cortana to my app(UWP with Winjs) but when i try to install the VCD file i got that error:Status is 'error', but getResults did not return an error

あなたのVCDに何か問題があるためですファイル - Command.xml。エラーはコード自体ではなくVCDファイルによって発生するので、エラーの詳細を取得できませんでした。

VCDファイルの特殊文字{}には、参照するPhraseListまたはPhraseTopicのLabel属性の値が含まれています。 ListenForまたはFeedback要素内で使用されます。 Feedback要素のPhraseListまたはPhraseTopic参照は、同じコマンド内のListenFor要素の対応する参照と一致する必要があります。ラベル属性の値に対応するPhraseListが必要

PhraseListまたはPhraseTopicは、コマンドセットのためのオプションの子ですが、あなたはVCDファイルにListenForとフィードバック要素のための{book}{name}を定義しますがが、name/bookです。

私はあなたに基づいてVCDファイルを更新しましたが、コードは正常に実行できます。

<?xml version="1.0" encoding="utf-8" ?> 
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2"> 
    <CommandSet xml:lang="en-us" Name="BibleCommandSet_en-us"> 
    <AppName> Bible </AppName> 
    <Example> Go to genesis 1,9 </Example> 
    <Command Name="goToQuote"> 
     <Example> Go to genesis 1,9 </Example> 
     <ListenFor RequireAppName="BeforeOrAfterPhrase"> show {book}</ListenFor> 
     <ListenFor RequireAppName="BeforeOrAfterPhrase"> show {book} {number}{number}</ListenFor> 
     <ListenFor RequireAppName="BeforeOrAfterPhrase"> open {book} {number}{number},{number}{number}</ListenFor> 
     <Feedback> Ok i'm opening {book} </Feedback> 
     <Navigate/> 
    </Command> 
    <PhraseList Label="book"> 
     <Item>London</Item> 
     <Item>Las Vegas</Item> 
     <Item>Melbourne</Item> 
     <Item>Yosemite National Park</Item> 
    </PhraseList> 
    <PhraseList Label="number"> 
     <Item>2</Item> 
     <Item>3</Item> 
     <Item>4</Item> 
     <Item>5</Item> 
    </PhraseList> 
    </CommandSet> 
</VoiceCommands> 

詳細については、this documentを参照してください。

+0

ありがとうサンテーンあなたは私にアイデアを与えた – JorgeCapillo

関連する問題