hello, i want to create a timer during which a program is going to work, i have the beginning of my program :
const int TicksPerMicrosecond = (int)TimeSpan.TicksPerMillisecond / 1000;
long startTime = System.DateTime.Now.Ticks;
int ticks = (int)(System.DateTime.Now.Ticks - startTime)>>1;
int microSeconds = ticks / TicksPerMicrosecond;
int Seconds = microSeconds*1000 000;
and i want to create a Timer lasting “Seconds”, and reuse it several times but with different values of “Seconds”, can you help me please, because after reading tuto and others I still do not understand how to create a timer.
thx
you could simply use a timer that runs every second and dispatch different tasks after different numbers of seconds - a simple dispatcher. Increment a counter each time in the timer, and run an action if your tolerance is met.
But it all depends on how you’re intending to use it.