Compartilhar via


StateChangedEventArgs Classe

Definição

Retorna os dados do evento StateChanged.

public ref class StateChangedEventArgs : EventArgs
public class StateChangedEventArgs : EventArgs
type StateChangedEventArgs = class
    inherit EventArgs
Public Class StateChangedEventArgs
Inherits EventArgs
Herança
StateChangedEventArgs

Exemplos

O exemplo a seguir demonstra as informações disponíveis 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);
    }
  }
}

Comentários

Uma instância de StateChangedEventArgs é criada quando o SpeechSynthesizer objeto aciona o StateChanged evento. Para obter os valores para o novo e o anterior SynthesizerState, acesse as State propriedades e PreviousState no manipulador do evento.

Propriedades

Nome Description
PreviousState

Obtém o estado do SpeechSynthesizer antes do evento StateChanged.

State

Obtém o estado do SpeechSynthesizer antes do evento StateChanged.

Métodos

Nome Description
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Aplica-se a