일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- Contour
- static
- Class
- wpf
- aduino
- mfc
- compare
- Barcode
- SERIAL
- c++
- atmega328
- length
- sensor
- UNO
- Encapusulation
- digitalRead
- stream
- Pointer
- memory
- java
- APP
- file access
- Unity
- 3D
- public
- Read
- preprocessing
- Android
- parameter
- flutter
- Today
- Total
폴크(FOLC)
WPF 테크닉 - Timer 운영 본문
# 특정 시점마다 반복적으로 작업을 간단하게 진행하기 위함.
> DispatcherTimer 를 이용하여 진행
# 소스 코드
using System.Windows.Threading;
namespace TimerRunTEST
{
public partial class MainWindow : Window
{
private DispatcherTimer timer = new DispatcherTimer(); // 타이머 생성
public MainWindow()
{
InitializeComponent();
// 타이머 설정
timer.Interval = TimeSpan.FromMilliseconds(1); // 시간간격 설정
timer.Tick += new EventHandler(timer_tick_event); // 이벤트 추가
}
private void timer_tick_event(object sender, EventArgs e)
{
// 실행 구문을 입력 한다.
}
public void timer_start()
{
timer.Start(); //타이머 시작
}
public void timer_stop()
{
timer.Stop(); //타이머 종료
}
}
}
'C#, WF, WPF(.NET) > C#, WF, WPF(.NET) 테크닉' 카테고리의 다른 글
C# 테크닉 - 문자열 인코딩 ( 한글 깨짐 ) (0) | 2022.03.06 |
---|---|
WPF 테크닉 - LiveChart 관련 site (0) | 2022.03.05 |
C# 테크닉 - 프로세스 검색 (0) | 2021.12.29 |
C# 테크닉 - 스크린 캡쳐 (Bitmap) (0) | 2021.12.10 |
C# 테크닉 - 시리얼 통신 ( RS232 ) (0) | 2021.12.10 |