using System; using System.Collections.Generic; using System.Reflection; using Neo.Afx.Services; namespace Neo.Afx.WinService.Workflows { public class WorkflowTask { readonly IWorker _taskInstance; readonly MethodInfo _method; public WorkflowTask(string typeName, string methodName, long userID, string userName, Dictionary settings) { var type = Type.GetType(typeName); _taskInstance = Worker.Create(typeName, userID, userName, settings); _method = type.GetMethod(methodName); } // returns the WorkflowInstanceTaskStatus public int Run(long taskID) { _taskInstance.TraceInfo = string.Empty; return (int)_method.Invoke(_taskInstance, new object[] { taskID }); } public string TraceInfo { get { return _taskInstance.TraceInfo; } } } }