Selecting an Item from a List
(Application Speech Control Sample)
This sample illustrates using the ListSelector and YesNo ASP.NET Application Speech Controls. In this sample, the controls are customized to illustrate how to override some of their properties. The sample also illustrates the use of other properties that are normally ignored at run time when the control runs using the default settings of the properties.
These two controls are deployed with other Application Speech Controls in an online dictionary scenario. When the application runs, it plays a greeting and then prompts the user to select a term. The user can select one of three terms: multipass sort, shell sort, or insertion sort. The user can follow one of two possible response paths:
- If the user says multipass sort, shell sort, or insertion sort, the application confirms the user's choice, displays the definition for that term, and then speaks the definition. Then application asks if the user wants to select another term. The user can say either yes or no. If the user says, yes, the application confirms that the user wants to hear more information, and then prompts the user to select another term. If the user says no, the application confirms that the user wants to leave the dictionary service, and then stops running.
- If the user is silent or mumbles in response to the application's prompt to select a term, the application prompts the user again. If the user remains silent or mumbles in response to being prompted three times, the application plays a prompt directing the user to try again later, and then stops running.
Featured Highlights
For the ListSelector control:
- Creating the main grammar for selecting the element, using the default grammar template of the ListSelector.
- Client-side variable persistence across postback using the ClientViewState object and the SpeechCommon.SetViewState and SpeechCommon.GetViewState methods.
- Adding preamble and postamble grammars to the main grammar.
- Using the ClientActivationFunction property.
- Overriding of default prompt functions.
For the YesNo control:
- Overriding of the default QuestionPrompt property.
Running the Sample
- Open the sample. The application plays a greeting, and then prompts the user to select a term. Valid choices include multipass sort, shell sort, and insertion sort.
- Say the name of a term. The application displays the definition of the term, and speaks the definition.
- When prompted by the application to select another term, say the name of a different term. The application displays the definition of the new term, and speaks the definition.
- When prompted by the application to select a new term, either remain silent or mumble.
- Either remain silent or mumble in response to two more prompts for the new term. After receiving no recognizable response for a third time, the application plays a message and stops running.
Remarks
This sample supports:
- BargeIn (the ability of the user to interrupt the prompt with a response).
- The global commands "Help" and "Repeat."
See Also
Application Speech Controls | Command Control | QA Control | SemanticMap Control | ClientActivationFunction Property | PromptSelectFunction Property | ClientViewState | Additional Client Scripting Elements