C#/WPF

[WPF] DispatcherTimer

딸기우유중독 2024. 7. 1. 08:47

 

 

일정 시간주기로 이벤트 실행.

 

using System;
using System.Windows.Threading;

private void InitTimer()
{
    DispatcherTimer timer = new DispatcherTimer();

    // 1초 마다 Tick 됩니다.
    timer.Interval = TimeSpan.FromMilliseconds(1000);

    // Event 특성상 여러 이벤트를 등록시킬 수 있습니다.
    timer.Tick += Timer_Tick;
    timer.Tick += Timer_Tick2;

    timer.Start();
}

private void Timer_Tick(object sender, System.EventArgs e)
{
    // logic here
}

private void Timer_Tick2(object sender, System.EventArgs e)
{
    // logic here
}

 


 

https://chashtag.tistory.com/46

 

[C#] [WPF] DispatcherTimer 사용방법

안녕하세요. 오늘은 WPF에서 사용가능한 DispatherTimer 사용방법에 대해 알아보도록 하겠습니다. DispatherTimer은 정해진 Interval마다 Tick Event Listener함수를 호출해주는 기능을 가지고 있습니다. using Syst

chashtag.tistory.com

 

 

 


 

728x90