Ejemplo n.º 1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public int ExecuteTask(Task task)
        {
            for (int i = 0; i < task.SubTask.Count; i++)
            {
                SubTask subTask = task.SubTask[i];
                object result = TaskManager.InvokeMethod(subTask.TypeName, subTask.MethodName, subTask.Param);

            }
            return 1;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载任务相关配置
        /// </summary>
        /// <param name="taskNo"></param>
        /// <returns></returns>
        public Task LoadTask(string taskNo)
        {
            Task task = new Task()
            {
                Id = taskNo,
                Name = "name:" + taskNo,
                Desc = "desc",
                Status = 0,
                SubTask = new List<SubTask>() {
                    new SubTask{ Id="subtask-1", Name="subtask-1", Desc="desc", TypeName="Library.TaskTest", MethodName="CollectData", Param=new object[]{"A10"}},
                    new SubTask{ Id="subtask-2", Name="subtask-2", Desc="desc", TypeName="Library.TaskTest", MethodName="ComputeData", Param=new object[]{"A10"}},
                    new SubTask{ Id="subtask-3", Name="subtask-3", Desc="desc", TypeName="Library.TaskTest", MethodName="WriteData", Param=new object[]{"A10"}},
                    new SubTask{ Id="subtask-4", Name="subtask-4", Desc="desc", TypeName="Library.TaskTest", MethodName="SendDataFresh", Param=new object[]{"A10"}}
                }
            };

            return task;
        }