public void Start(string name) { TimerHelper th = null; if (data.Contains(name)) { th = (TimerHelper)data[name]; if (th.running) { return; } } else { th = new TimerHelper(); th.millisUntiNow = TimeSpan.Zero; data.Add(name, th); } th.start = System.DateTime.Now; th.running = true; }
public void Stop(string name) { TimerHelper th = null; if (data.Contains(name)) { th = (TimerHelper)data[name]; if (th.running) { TimeSpan more = System.DateTime.Now - th.start; th.millisUntiNow += more; } else { return; } } else { return; } th.running = false; }