I am trying to have one timer which will do things every 5 seconds or by user specified time interval.
Now, I want to have a function which will count down in 10 milliseconds interval until tick of first timer. I have played around and found a simple way of doing this by doing count of 1/10 of first timers tick interval but when counting the number doesn't represent anything.
How to do such count down?
This is how I have at this time, but I want to change it:
private void tmrClickInterval_Tick(object sender, EventArgs e)
{
if (nudPlusMinus.Value == 0) tmrClickInterval.Interval = int.Parse(nudClickInterval.Value.ToString());
else tmrClickInterval.Interval = random.Next(int.Parse(nudClickInterval.Value.ToString()) - int.Parse(nudPlusMinus.Value.ToString()), int.Parse(nudClickInterval.Value.ToString()) + int.Parse(nudPlusMinus.Value.ToString()));
if (tmrClickInterval.Interval / 10 == 0) tmrNextClick.Interval = 1;
else tmrNextClick.Interval = tmrClickInterval.Interval / 10;
tmrNextClick.Start();
content++;
nextClick = tmrClickInterval.Interval;
label1.Text = content.ToString();
}
private void tmrNextClick_Tick(object sender, EventArgs e)
{
if (nextClick <= 0) tmrNextClick.Stop();
else
{
nextClick = nextClick - (tmrClickInterval.Interval / 10);
lblNextClickCount.Text = (nextClick / 100).ToString();
}
}