StateChangedEventArgs Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne les données de l’événement StateChanged .
public ref class StateChangedEventArgs : EventArgs
public class StateChangedEventArgs : EventArgs
type StateChangedEventArgs = class
inherit EventArgs
Public Class StateChangedEventArgs
Inherits EventArgs
- Héritage
Exemples
L’exemple suivant illustre les informations disponibles sur l’événement StateChanged .
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);
}
}
}
Remarques
Une instance de l’objet StateChangedEventArgs est créée lorsque l’objet SpeechSynthesizer déclenche l’événement StateChanged . Pour obtenir les valeurs du nouveau et du précédentSynthesizerState, accédez aux propriétés et PreviousState aux State propriétés du gestionnaire pour l’événement.
Propriétés
| Nom | Description |
|---|---|
| PreviousState |
Obtient l’état de l’événement SpeechSynthesizer avant l’événement StateChanged . |
| State |
Obtient l’état de l’événement SpeechSynthesizer avant l’événement StateChanged . |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Détermine si l’objet spécifié est égal à l’objet actuel. (Hérité de Object) |
| GetHashCode() |
Sert de fonction de hachage par défaut. (Hérité de Object) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |