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)); }
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)); }
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); }
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); }