Creating the Class and SemanticItem Property
Start creating an example Application Speech Control by creating a new class that inherits from ApplicationControl in the Microsoft.Web.UI.SpeechControls.ApplicationControls namespace, and adding a constructor method.
using System;
using Systm.ComponentModel;
using System.Reflection;
using System.Web.UI;
using Microsoft.Speech.Web.UI;
namespace ColorChooserControl
{
public class ColorChooser : ApplicationControl
{
public ColorChooser()
{}
}
}
Next, declare a private string to store the name of the semantic item, and define a SemanticItem property. In order to make the SemanticItem property appear under the Speech category of the control's properties page in Visual Studio, precede the property definition with a line that designates the property as a member of the speech category.
#region Private Members
private string _semanticItem = string.Empty;
#endregion Private Members
#region Properties
[Category("Speech")]
public string SemanticItem
{
get
{
return _semanticItem;
}
set
{
if(value == null)
{
_semanticItem = string.Empty;
}
_semanticItem = value;
}
}
#endregion Properties
See Also
Creating ColorChooser: A Custom Application Speech Control | Creating the Grammars | Implementing the Dialogue Flow | Generating Prompts | Creating a Client-Side Object and SALT