예제 #1
0
        /// <summary>
        /// 使用实现定时接口ITimerTask的实例创建定时任务
        /// </summary>
        /// <param name="info"></param>
        /// <param name="_ins"></param>
        /// <returns></returns>
        public static Thread CreateTimerTaskService(TimerInfo info, ITimerTask _ins)
        {
            TimerTaskService tus = new TimerTaskService(info, _ins);
            //创建启动线程
            Thread ThreadTimerTaskService = new Thread(new ThreadStart(tus.Start));

            return(ThreadTimerTaskService);
        }
예제 #2
0
        /// <summary>
        /// 使用委托方法创建定时任务
        /// </summary>
        /// <param name="info"></param>
        /// <param name="_ptrd"></param>
        /// <param name="parm"></param>
        /// <returns></returns>
        public static Thread CreateTimerTaskService(TimerInfo info, TimerTaskDelegate _ptrd, params object[] parm)
        {
            TimerTaskService tus = new TimerTaskService(info, _ptrd);

            tus.setParm(parm);

            //创建启动线程
            Thread ThreadTimerTaskService = new Thread(new ThreadStart(tus.Start));

            return(ThreadTimerTaskService);
        }