Bagikan melalui


DispatcherTimer.Start Metode

Definisi

DispatcherTimerMemulai .

public:
 void Start();
public void Start ();
member this.Start : unit -> unit
Public Sub Start ()

Contoh

Contoh berikut membuat sebuah DispatcherTimer. Objek baru DispatcherTimer bernama dispatcherTimer dibuat. Penanganan aktivitas dispatcherTimer_Tick ditambahkan ke Tick peristiwa. Interval diatur ke 1 detik menggunakan TimeSpan objek .

//  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()

Keterangan

Pengaturan IsEnabled ke false ketika timer dimulai menghentikan timer.

Pengaturan IsEnabled ke true ketika timer dihentikan memulai timer.

StartIsEnabled diatur ke true.

Start mengatur ulang timer Interval.

Berlaku untuk