StateChangedEventArgs Classe
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.
Devolve dados do StateChanged evento.
public ref class StateChangedEventArgs : EventArgs
public class StateChangedEventArgs : EventArgs
type StateChangedEventArgs = class
inherit EventArgs
Public Class StateChangedEventArgs
Inherits EventArgs
- Herança
Exemplos
O exemplo seguinte demonstra a informação disponível sobre o StateChanged evento.
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.SetOutputToDefaultAudioDevice();
// Subscribe to StateChanged event.
synth.StateChanged += new EventHandler<StateChangedEventArgs>(synth_StateChanged);
// Subscribe to the SpeakProgress event.
synth.SpeakProgress += new EventHandler<SpeakProgressEventArgs>(synth_SpeakProgress);
// Speak the prompt.
synth.Speak("What is your favorite color?");
// Pause the SpeechSynthesizer object.
synth.Pause();
// Resume the SpeechSynthesizer object.
synth.Resume();
}
Console.WriteLine("\nPress any key to exit...");
Console.ReadKey();
}
// Write the state of the SpeechSynthesizer to the console.
static void synth_StateChanged(object sender, StateChangedEventArgs e)
{
Console.WriteLine("State: {0} Previous State: {1}\n", e.State, e.PreviousState);
}
// Write the speak progress of the SpeechSynthesizer to the console.
static void synth_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
Console.WriteLine(e.Text);
}
}
}
Observações
Uma instância de StateChangedEventArgs é criada quando o SpeechSynthesizer objeto levanta o StateChanged evento. Para obter os valores do novo e do anterior SynthesizerState, acede às State propriedades e PreviousState no handler do evento.
Propriedades
| Name | Description |
|---|---|
| PreviousState |
Percebe o estado do SpeechSynthesizer antes do StateChanged evento. |
| State |
Percebe o estado do SpeechSynthesizer antes do StateChanged evento. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |