StateChangedEventArgs Clase
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Devuelve datos del evento StateChanged.
public ref class StateChangedEventArgs : EventArgs
public class StateChangedEventArgs : EventArgs
type StateChangedEventArgs = class
inherit EventArgs
Public Class StateChangedEventArgs
Inherits EventArgs
- Herencia
En el ejemplo siguiente se muestra la información disponible sobre el 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);
}
}
}
Se crea una instancia de StateChangedEventArgs cuando el SpeechSynthesizer objeto genera el StateChanged evento . Para obtener los valores del nuevo y anterior SynthesizerState, acceda a las State propiedades y PreviousState del controlador para el evento .
Previous |
Obtiene el estado de SpeechSynthesizer antes del evento StateChanged. |
State |
Obtiene el estado de SpeechSynthesizer antes del evento StateChanged. |
Equals(Object) |
Determina si el objeto especificado es igual que el objeto actual. (Heredado de Object) |
Get |
Sirve como la función hash predeterminada. (Heredado de Object) |
Get |
Obtiene el Type de la instancia actual. (Heredado de Object) |
Memberwise |
Crea una copia superficial del Object actual. (Heredado de Object) |
To |
Devuelve una cadena que representa el objeto actual. (Heredado de Object) |
Produto | Versións |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Comentarios de .NET
.NET é un proxecto de código aberto. Selecciona unha ligazón para ofrecer comentarios: