I want to adjust the value of the interval as a button event.
When you click the button, the value increases by 1, then reducing to the
interval want to calculate the value in seconds.
This applies not adjust the interval.
// Button click event
private void Start_sorting_Click(object sender, RoutedEventArgs e)
{
// The currValue the interval value.
this.CurrentValue.Content = currValue;
// timer start
if (_timer.IsEnabled == false)
{
timerStatus = 1;
_timer.Tick += timer_tick;
_timer.Interval = new TimeSpan(0, 0, currValue);
_timer.Start();
}
}
private void timer_tick(object sender, EventArgs e)
{
traceInfo = this.sortingInfos[this.sortingInfosIndex++];
// Animation proceeds for about one second.
start_animation(traceInfo.Position, traceInfo.TargetPosition);
if (sortingInfosIndex >= sortingInfos.Count)
{
_timer.Stop();
}
}
// Button click event, interval up
private void repeatAddvalueButton_Click(object sender, RoutedEventArgs e)
{
currValue++;
this.CurrentValue.Content = currValue;
_timer.Interval.Add( new TimeSpan(0, 0, currValue));
}
// Button click event, interval down
private void repeatRemoveValueButton_Click(object sender, RoutedEventArgs e)
{
currValue--;
this.CurrentValue.Content = currValue;
_timer.Interval.Subtract(new TimeSpan(0, 0, 1));
}