Ejemplo n.º 1
0
        /// <summary>
        /// 更行定时性任务的属性
        /// </summary>
        /// <param name="mId">定时性任务ID</param>
        /// <param name="property">定时性任务属性名集合</param>
        /// <param name="val">待更新的值集合</param>
        /// <returns></returns>
        public static CTimerMission UpdateTimerMission(int mId, List <string> property, List <object> val)
        {
            Jobs          timer_jobs = new Jobs();
            CTimerMission tm         = CreateTimerMission(timer_jobs.UpdateJob(mId, property, val));

            ActiveListActionForMission(tm);
            return(tm);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加一个定时性任务
 /// </summary>
 /// <param name="tm">添加的任务</param>
 public static void AppendMissionToActiveList(CTimerMission tm)
 {
     //如果添加的任务状态为ACTIVE
     if (tm.status == TM_STATUS.TM_STATUS_ACTIVE)
     {
         //添加到当前任务列表
         lock (missions) //任务列表加锁
         {
             if (missions.Find(delegate(CTimerMission mis) { return(mis.ID == tm.ID); }) == null)
             {
                 missions.Add(tm);
             }
         }
         //tm.manage = this;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 针对具体任务, 活动列表的响应操作
 /// </summary>
 /// <param name="tm"></param>
 public static void ActiveListActionForMission(CTimerMission tm)
 {
     if (tm == null)
     {
         return;
     }
     lock (missions)
     {
         CTimerMission t = missions.Find(delegate(CTimerMission miss) { return(miss.ID == tm.ID); });
         if (tm.status == TM_STATUS.TM_STATUS_ACTIVE && t == null) //tm的状态为激活状态, 且未添加到活动列表
         {
             missions.Add(tm);
         }
         else if (tm.status == TM_STATUS.TM_STATUS_ACTIVE && t != null) //tm的状态为激活状态, 且已添加到活动列表
         {
             missions.Remove(t);
             missions.Add(tm);
         }
         else if (tm.status != TM_STATUS.TM_STATUS_ACTIVE && t != null)  //tm的状态为非激活, 且已添加到活动列表
         {
             missions.Remove(t);
         }
     }
 }