Пример #1
0
        public bool StopTask(string taskId, ref string errorinfo)
        {
            TaskThread taskThread = m_TaskThreadList.Single(t => t.TaskModel.ID == taskId);

            if (taskThread == null)
            {
                errorinfo = "该任务不存在";
                return(false);
            }
            return(taskThread.StopTask(ref errorinfo));
        }
Пример #2
0
        public bool StartTask(string taskId, ref string errorinfo)
        {
            TaskThread taskThread = m_TaskThreadList.Single(t => t.TaskModel.ID == taskId);

            if (taskThread == null)
            {
                taskThread = new TaskThread(taskId);
                taskThread.StartTask(ref errorinfo);
                m_TaskThreadList.Add(taskThread);
                return(true);
            }
            return(taskThread.StartTask(ref errorinfo));
        }
Пример #3
0
 public bool TaskDispose()
 {
     while (!m_TaskThreadList.IsEmpty)
     {
         TaskThread task = null;
         m_TaskThreadList.TryTake(out task);
         if (task != null)
         {
             string errorinfo = "";
             task.StopTaskForce(ref errorinfo);
         }
     }
     m_Worked = false;
     return(true);
 }
Пример #4
0
        public bool TaskInit()
        {
            List <Model.T_D_TASK_MSTModel> taskList = Access.Task.GetAllTask().FindAll(delegate(Model.T_D_TASK_MSTModel m) { return(m.SFJY == 0); });

            foreach (Model.T_D_TASK_MSTModel task in taskList)
            {
                TaskThread taskThread = new TaskThread(task.ID);
                string     errorinfo  = "";
                taskThread.EventThreadMessage += new Model.EventMessageHandler(EventReciveThreadMessage);
                taskThread.StartTask(ref errorinfo);
                m_TaskThreadList.Add(taskThread);
            }
            m_Worked = true;
            return(true);
        }