사용자 지정 애니메이션을 사용하여 Silverlight 응용 프로그램을 개발하고 있습니다. 변수 animationCounter를 1 밀리 초마다 업데이트하여 1 초에 값이 1000이되도록하고 싶습니다. DispatcherTimer 및 System.Threading.Timer를 시도했습니다. 이 방법 :Silverlight 타이머 문제
DispatcherTimer timer = new DispatcherTimer(); (...)
timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
timer.Tick += new EventHandler(timer_Tick); (...)
(...)이 System.Threading.Timer
System.Threading timer = null;
timer = new System.Threading.Timer(UpdateAnimationCounter, 0, 1);
void UpdateAnimationCounter(object state)
{
animationCounter++;
Dispatcher.BeginInvoke(() => txtAnimationCounter.Text = animationCounter.ToString());
}
둘 다 1 초에 약 100 AnimationCounter를 설정하는과
void timer_Tick(object sender, EventArgs e)
{
animationCounter++;
Dispatcher.BeginInvoke(() => txtAnimationCounter.Text = animationCounter.ToString());
}
. 1000이어야합니다. 왜 그런지 모르겠습니다. 내가 빠진 것이 있니?
감사
또한 10ms 해상도를 나타내는 문서는 발견되지 않았지만 다른 사이트에서는 힌트를 표시했습니다. –
감사합니다. 나는 그것을 몰랐다. 네, 10ms 해상도가 괜찮을 것 같습니다. 동기화시 일부 애니메이션 이벤트를 시작하려면이 값이 필요합니다. – jose