我的应用程序中的计时器正在做一些更改,我希望它在更改对我来说足够时停止,当它执行stop()
它不会停止的方法时。
timerpartAnimation = new DispatcherTimer();
timerpartAnimation.Interval = TimeSpan.FromMilliseconds(1);
timerpartAnimation.Tick += timer_Tick_Anime;
timerpartAnimation.Start();
public void timer_Tick_Anime(object sender, object e)
{
newL-=3;
newT = A * newL + B;
playPart33.Margin = new Thickness(newL, newT, playPart33.Margin.Right, playPart33.Margin.Bottom);
if (dis(playPart33.Margin, currentIm.Margin))
{
timerpartAnimation.Stop();
currentIm.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
}
奇怪的是这一行:
currentIm.Visibility = Windows.UI.Xaml.Visibility.Visible;
确实发生了,所以它是 deffenetly 进入 if 范围。
有人有想法吗?