Share via


DispatcherTimer.IsEnabled Propriedade

Definição

Obtém ou define um valor que indica se o temporizador está em execução.

public:
 property bool IsEnabled { bool get(); void set(bool value); };
public bool IsEnabled { get; set; }
member this.IsEnabled : bool with get, set
Public Property IsEnabled As Boolean

Valor da propriedade

true se o temporizador estiver habilitado; caso contrário, false. O padrão é false.

Exemplos

O exemplo a seguir cria um DispatcherTimer. Um novo DispatcherTimer objeto chamado dispatcherTimer é criado. O manipulador dispatcherTimer_Tick de eventos é adicionado ao Tick evento. O Interval é definido como 1 segundo usando um TimeSpan objeto .

//  DispatcherTimer setup
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Start();
'  DispatcherTimer setup
dispatcherTimer = New Threading.DispatcherTimer()
AddHandler dispatcherTimer.Tick, AddressOf dispatcherTimer_Tick
dispatcherTimer.Interval = New TimeSpan(0,0,1)
dispatcherTimer.Start()

Comentários

IsEnabled deve ser definido true como para o Tick evento a ser gerado.

A chamada Start define IsEnabled como true.

A chamada Stop define IsEnabled como false.

Aplica-se a