示例#1
0
        /// <summary>
        /// 注册一个Event
        /// </summary>
        /// <param name="action">执行的委托,返回object</param>
        /// <param name="actionType">执行类型</param>
        /// <param name="callBack">回调方法</param>
        public PtiEventer RegEvent(Func <PtiEventer, object> action, PtiEventType actionType, Func <PtiEventer, object> callBack = null)
        {
            PtiEventer ptiEvent = PtiEventer.Create(actionType, this, action, callBack);

            this.RegEvent(ptiEvent);
            return(ptiEvent);
        }
示例#2
0
        /// <summary>
        /// 注册一个LoopEvent (LoopEvent只有在EventManager启动之前注册有效)
        /// </summary>
        /// <param name="action">执行的委托,返回object</param>
        /// <param name="actionType">执行的类型</param>
        /// <param name="interval">执行间隔</param>
        /// <param name="IsImmediately">是否立即执行</param>
        /// <param name="callBack">回调方法,传入object</param>
        public PtiEventer RegLoopEvent(Func <PtiEventer, object> action, PtiEventType actionType, TimeSpan interval, bool IsImmediately = false, Func <PtiEventer, object> callBack = null)
        {
            PtiEventer ptiEvent = PtiEventer.Create(actionType, this, action, callBack);

            ptiEvent.IsLoopEvent = true;
            this.RegLoopEvent(ptiEvent, interval, IsImmediately);
            return(ptiEvent);
        }