c# - How to increment running timer -
in application define timer , set interval x seconds. after when 'click' event occurs want increment running timer y more seconds.
how can this?
the code sample:
private static timer stimer = new timer(); stimer.interval = 50000;
when event invoked want that:
stimer.interval = timeleftinms + 5000;
you should create custom timer, inherits system.timers.
have private stopwatch stopwatch = new stopwatch();
private member.
on timer.start: stopwatch.start();
on timer.tick: stopwatch.reset();
on
timer.interval set { _timer.interval = _timer.interval - stopwatch.elapsed.miliseconds + value; }
Comments
Post a Comment