PromptBuilder.AppendPromptBuilder(PromptBuilder) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Aggiunge un oggetto PromptBuilder a un altro oggetto PromptBuilder.
public:
void AppendPromptBuilder(System::Speech::Synthesis::PromptBuilder ^ promptBuilder);
public void AppendPromptBuilder (System.Speech.Synthesis.PromptBuilder promptBuilder);
member this.AppendPromptBuilder : System.Speech.Synthesis.PromptBuilder -> unit
Public Sub AppendPromptBuilder (promptBuilder As PromptBuilder)
Parametri
- promptBuilder
- PromptBuilder
Il contenuto da aggiungere.
Esempio
L'esempio seguente crea PromptBuilder due istanze e quindi le aggiunge a un terzo PromptBuilder .
using System;
using System.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the audio output.
synth.SetOutputToWaveFile(@"C:\test\showtimes.wav");
// Create a SoundPlayer instance to play the output audio file.
System.Media.SoundPlayer m_SoundPlayer =
new System.Media.SoundPlayer(@"C:\test\showtimes.wav");
// Build child prompts.
PromptBuilder theatreA = new PromptBuilder();
theatreA.AppendText(
"Tonight's movie showings in theater A are at 5:45, 7:15, and 9:30");
theatreA.AppendBreak(PromptBreak.Large);
PromptBuilder theatreB = new PromptBuilder();
theatreB.AppendText(
"Tonight's movie showings in theater B are at 5:15, 7:15, and 9:15");
// Build the parent prompt and append the two child prompts.
PromptBuilder showTimes = new PromptBuilder(
new System.Globalization.CultureInfo("en-US"));
showTimes.AppendText(
"The following are the show times for tonight's movies:");
showTimes.AppendPromptBuilder(theatreA);
showTimes.AppendPromptBuilder(theatreB);
// Speak the prompt and play back the output file.
synth.Speak(showTimes);
m_SoundPlayer.Play();
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}