タイマーを開始すると..timelは通常どおりインクリメントされます..しかし、タイマーを停止するとすぐに、つまりclick_TimerStop関数を呼び出してタイマーを再度開始します.timel変数はtimel + = 2だけインクリメントされます..そして、プロセス .. timel+=3 だけ増加します..そして、それは何度も続きます ...どうすればこれを修正できますか?..
DispatcherTimer clktimer = new DispatcherTimer();
private void click_TimerStart(object sender, RoutedEventArgs e)
{
clktimer.Start();
clktimer.Interval =new TimeSpan(0,0,1);
clktimer.Tick +=clktimer_tick;
}
private int timel = 0;
private void clktimer_tick(object sender, object e)
{
timel++;
timerSecond.Text = timel.ToString();
}
private void click_TimerStop(object sender, RoutedEventArgs e)
{
clktimer.Stop();
}