Global Timer i.e. A Timer which works on multiple forms. - C# -
i wondering if possible create timer isnt bound single form. im making quiz , want user have 2 minutes answer questions. once 2 minutes current form close , endscreen appear. time must visible @ times. great.
yes can use static class static dispatch timer.
public static class statictimer` { public static dispatchertimer timer { get; set; } }
in form use:
staticclass.timer = new dispatchertimer(); staticclass.timer.interval = new timespan(0, 0, 0, 0, 100); staticclass.timer.tick += timer_tick; staticclass.timer.start(); public void timer_tick(object sender, eventargs e) { logic.... }
Comments
Post a Comment