SpeakProgressEventArgs.Text Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
O texto que acabou de ser dito quando o evento foi levantado.
public:
property System::String ^ Text { System::String ^ get(); };
public string? Text { get; }
public string Text { get; }
member this.Text : string
Public ReadOnly Property Text As String
Valor de Propriedade
Devolve a mensagem que acabara de ser dita quando o evento foi levantado.
Exemplos
O exemplo seguinte ilustra como o SpeakProgress evento reporta as CharacterPosition propriedades e Text para cadeias que contêm números.
using System;
using System.Xml;
using System.IO;
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.SetOutputToDefaultAudioDevice();
// Create an XML Reader from the file, create a PromptBuilder and
// append the XmlReader.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("4003");
// Add a handler for the SpeakProgress event.
synth.SpeakProgress +=
new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);
// Speak the prompt and play back the output file.
synth.Speak(builder);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
// Write each word and its character position to the console.
static void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
Console.WriteLine("Speak progress - Character position: {0} Text: {1}",
e.CharacterPosition, e.Text);
}
}
}
Observações
Normaliza SpeechSynthesizer os números para as palavras que correspondem à forma como o número será pronunciado. Por exemplo, o sintetizador pronuncia o número "4003" como "quatro mil três". Cria um SpeakProgress evento para cada uma das palavras faladas. No entanto, a Text propriedade de cada uma das três palavras é a mesma. É o texto "4003" do prompt.