Compartilhar via


PromptDatabaseCollection Remarks

  Microsoft Speech Technologies Homepage

The PromptDatabaseCollection control represents a collection of PromptDatabase controls.

Application authors can define PromptDatabaseCollection controls on the Web pages, in the web.config files, or in the code-behind modules of their Speech applications.

Example 1

The following ASP.NET code segment demonstrates a PromptDatabaseCollection control used within a QA.Prompt control. The collection contains two PromptDatabase controls.

<form id="Form1" method="post" runat="server">
  ...
  <speech:QA ID="QA1" runat="server">
    ...
    <Prompt>
      <PromptDatabases>
        <speech:PromptDatabase ID="PD1" Source="Prompts\Prompts1.promptdb">
        </speech:PromptDatabase>
        <speech:PromptDatabase ID="PD2" Source="Prompts\Prompts2.promptdb">
       </speech:PromptDatabase>
      </PromptDatabases>
    </Prompt>
    ...
  </speech:QA>
  ...
</form>

Example 2

The following C# code segment is taken from the ColorChooserControl sample and described in the section Implementing the Dialogue Flow.

In this code, _question is a QA control within the ColorChooserControl. When an application creates the ColorChooserControl, this code initializes the internal _question control with references to all PromptDatabases referenced by the application.

For each PromptDatabase control in the application's PromptDatabaseCollection, the code creates a new PromptDatabase control, referencing the same PromptDatabase, in the _question control's PromptDatabaseCollection.

foreach(PromptDatabase database in PromptDatabases)
{
  PromptDatabase tempDatabase = new PromptDatabase();
  tempDatabase.Source = database.Source;
  _question.Prompt.PromptDatabases.Add(tempDatabase);
}

See Also

PromptDatabaseCollection Class | PromptDatabaseCollection Constructor | PromptDatabaseCollection Members | PromptDatabaseCollection Properties | PromptDatabaseCollection Methods