Ejemplo n.º 1
0
        public static void add_timer(update_control_func updater, terminate_update_func terminator, int refresh_ms = 100)
        {
            updater(false);

            Timer t = new Timer()
            {
                Interval = refresh_ms
            };

            t.Tick += (sender, args) => {
                bool has_terminated = terminator();
                if (has_terminated)
                {
                    t.Enabled = false;
                    t.Dispose();
                }
                updater(has_terminated);
            };
            t.Enabled = true;
        }
Ejemplo n.º 2
0
 // update_ms = how long to update the control visually
 public static void add_timer(update_control_func updater, int update_ms, int refresh_ms = 100)
 {
     DateTime end = DateTime.Now.AddMilliseconds(update_ms);
     add_timer( updater, () => (DateTime.Now > end), refresh_ms );
 }
Ejemplo n.º 3
0
        public static void add_timer(update_control_func updater, terminate_update_func terminator, int refresh_ms = 100)
        {
            updater(false);

            Timer t = new Timer(){ Interval = refresh_ms };
            t.Tick += (sender, args) => {
                bool has_terminated = terminator();
                updater(has_terminated);
                if (has_terminated) {
                    t.Enabled = false;
                    t.Dispose();
                }
            };
            t.Enabled = true;
        }
Ejemplo n.º 4
0
        // update_ms = how long to set_aliases the control visually
        public static void add_timer(update_control_func updater, int update_ms, int refresh_ms = 100)
        {
            DateTime end = DateTime.Now.AddMilliseconds(update_ms);

            add_timer(updater, () => (DateTime.Now > end), refresh_ms);
        }