Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }