Beispiel #1
0
        public static void SetTimer(delEmpty callback, int time)
        {
            MyTimer ttt = new MyTimer();

            t.Add(ttt);
            callbacks.Add(callback);
            callframes.Add(MyTimer.CurrentFrame);

            ttt.Interval = time;
            ttt.Tick    += new EventHandler(ttt_Tick);
            ttt.Start();
        }
Beispiel #2
0
        static void ttt_Tick(object sender, EventArgs e)
        {
            search = (MyTimer)sender;
            int ind = t.FindIndex(Pred);

            if (callframes[ind] == MyTimer.CurrentFrame)
            {
                return;
            }

            search.Stop();
            callbacks[ind].Invoke();

            t.RemoveAt(ind);
            callbacks.RemoveAt(ind);
            callframes.RemoveAt(ind);
        }
Beispiel #3
0
 static bool Pred(MyTimer q)
 {
     return(q == search);
 }