Пример #1
0
        /// <summary>
        /// Create a new timer.  This timer only calls its own event subroutine.
        /// </summary>
        /// <param name="tick">The event subroutine for this timer.</param>
        /// <returns>The timer name.</returns>
        public static Primitive AddTick(Primitive tick)
        {
            ObjTimer objTimer = GetNewTimer();

            MethodInfo methodInfo = mainModule.GetMethod(tick, BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);

            if (null != methodInfo)
            {
                objTimer.Tick += (SmallBasicCallback)Delegate.CreateDelegate(typeof(SmallBasicCallback), methodInfo);
            }

            return(objTimer.Name);
        }
Пример #2
0
        private static ObjTimer GetNewTimer()
        {
            int      i = 1;
            ObjTimer objTimer;

            while (timers.TryGetValue("Timer" + i, out objTimer))
            {
                i++;
            }
            string name = "Timer" + i;

            objTimer     = new ObjTimer(name);
            timers[name] = objTimer;
            return(objTimer);
        }
Пример #3
0
 private static ObjTimer GetNewTimer()
 {
     int i = 1;
     ObjTimer objTimer;
     while (timers.TryGetValue("Timer" + i, out objTimer)) i++;
     string name = "Timer" + i;
     objTimer = new ObjTimer(name);
     timers[name] = objTimer;
     return objTimer;
 }
Пример #4
0
        /// <summary>
        /// Create a new timer.  All timers created with this method call the event subroutine defined by Tick.
        /// </summary>
        /// <returns>The timer name.</returns>
        public static Primitive Add()
        {
            ObjTimer objTimer = GetNewTimer();

            return(objTimer.Name);
        }