public AutomationUnit(IAutomation automation, AutomationContext context, DelegateAutomationDone callback, object stateObject, AutomationUnit callingUnit) { _automation = automation; _context = context; _callback = callback; _callbackStateObject = stateObject; _callingUnit = callingUnit; }
/// <summary> /// 执行自动化作业 /// </summary> /// <remarks>作业上下文会在这个函数内部被复制,从而保证作业各自的上下文不会互相干扰,而只能对各自的后续作业产生影响</remarks> public void Do(IAutomation automation, AutomationContext context, DelegateAutomationDone callback, object stateObject, AutomationUnit callingUnit) { if (automation == null) { throw new ArgumentNullException("automation"); } if (context == null) { throw new ArgumentNullException("context"); } _toBeAddList.Add(new AutomationUnit(automation, (AutomationContext)context.Clone(), callback, stateObject, callingUnit)); }
/// <summary> /// 执行自动化作业 /// </summary> /// <remarks>简化版,免回调</remarks> public void Do(IAutomation automation, AutomationContext context, DelegateAutomationDone callback, object stateObject) { Do(automation, context, callback, stateObject, null); }