2012-07-30 31 views
9

C# içinde bir zamanlayıcı kullanarak 10 saniye sonra WPF penceresini kapatma (otomatik gizle) nasıl yapılır? Kisok Ekranı NeZamanlayıcıyı kullanarak 10 saniye sonra WPF penceresini kapatma (otomatik gizle)

private void StartCloseTimer() 
{ 
    DispatcherTimer timer = new DispatcherTimer(); 
    timer.Interval = TimeSpan.FromSeconds(10d); 
    timer.Tick += TimerTick; 
    timer.Start(); 
} 

private void TimerTick(object sender, EventArgs e) 
{ 
    DispatcherTimer timer = (DispatcherTimer)sender; 
    timer.Stop(); 
    timer.Tick -= TimerTick; 
    Close(); 
} 
+0

geçerli: –

+0

Sadece bir WPF formu – Shashank

cevap

İlgili konular