hasan
hasan

Reputation: 1094

windows phone voice command syntax

I wonted to know is there any way to have optional Phrase in windows phone 8 voice commands. I mean something like this:

<Command Name="actoin">
  <Example>he goes to school</Example>
  <ListenFor> he goes to school [{with}] [{time}]  </ListenFor>
  <Feedback>ok!</Feedback>
  <Navigate Target="MainPage.xaml"/>
</Command>

<PhraseList Label="with">
  <Item>by bus</Item>
  <Item>by tax</Item>
  <Item>by his father</Item>
</PhraseList>
<PhraseList Label="time">
  <Item>sometimes</Item>
  <Item>always<Item>
</PhraseList>

actually i want to make with and time optional and avoid writing a separate command for each combination of them!

thanks

Upvotes: 0

Views: 84

Answers (1)

Eric Brown
Eric Brown

Reputation: 13932

You can have multiple <ListenFor> elements (up to 10) per command; you could build the options that way.

For example:

<Command Name="action">
  <Example>he goes to school</Example>
  <ListenFor> he goes to school {with} {time}  </ListenFor>
  <ListenFor> he goes to school {time}  </ListenFor>
  <ListenFor> he goes to school {with}  </ListenFor>
  <ListenFor> he goes to school </ListenFor>
  <Feedback>ok!</Feedback>
  <Navigate Target="MainPage.xaml"/>
</Command>

<PhraseList Label="with">
  <Item>by bus</Item>
  <Item>by tax</Item>
  <Item>by his father</Item>
</PhraseList>
<PhraseList Label="time">
  <Item>sometimes</Item>
  <Item>always<Item>
</PhraseList>

Upvotes: 1

Related Questions