Action that should be executed on next idle after certain amount of milliseconds
Ejemplo n.º 1
0
        /// <summary>
        /// Create delayed idle time action
        /// </summary>
        /// <param name="action">Action to execute on idle</param>
        /// <param name="delay">Minimum number of milliseconds to wait before executing the action</param>
        /// <param name="tag">Object that uniquely identifies the action. Typically creator object.</param>
        public static void Create(Action action, int delay, object tag) {
            IdleTimeAction existingAction;

            if (!_idleActions.TryGetValue(tag, out existingAction)) {
                existingAction = new IdleTimeAction(action, delay, tag);
                _idleActions[tag] = existingAction;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create delayed idle time action
        /// </summary>
        /// <param name="action">Action to execute on idle</param>
        /// <param name="delay">Minimum number of milliseconds to wait before executing the action</param>
        /// <param name="tag">Object that uniquely identifies the action. Typically creator object.</param>
        public static void Create(Action action, int delay, object tag)
        {
            IdleTimeAction existingAction;

            if (!_idleActions.TryGetValue(tag, out existingAction))
            {
                existingAction    = new IdleTimeAction(action, delay, tag);
                _idleActions[tag] = existingAction;
            }
        }