Пример #1
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <returns></returns>
 private void ExcuteUpdate(object obj)
 {
     for (int i = 0; i < modelList.Count; i++)
     {
         TimerModel model = modelList[i];
         if (time - model.startTime >= model.endTime)
         {
             model.startTime = time;
             if (model.autoReset)
             {
                 model.isEnd = true;
             }
             ThreadPool.QueueUserWorkItem(new WaitCallback(model.StartTesk));
             //new Thread(model.StartTesk).Start(obj);
         }
     }
     modelList.RemoveAll(d => d.isEnd);
     //应该从数据库获得Paper对象的集合,这里简略
     Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"));
     ////执行数据更新,这里省略
 }
Пример #2
0
 /// <summary>
 /// 添加时间成员
 /// </summary>
 /// <param name="model"></param>
 public void AddTimerModel(TimerModel model)
 {
     modelList.Add(model);
 }