public override bool Evaluate(Activity ownerActivity, IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } ConditionalEventArgs e = new ConditionalEventArgs(); EventHandler <ConditionalEventArgs>[] invocationList = base.GetInvocationList <EventHandler <ConditionalEventArgs> >(ConditionEvent); IWorkflowDebuggerService service = provider.GetService(typeof(IWorkflowDebuggerService)) as IWorkflowDebuggerService; if (invocationList != null) { foreach (EventHandler <ConditionalEventArgs> handler in invocationList) { if (service != null) { service.NotifyHandlerInvoking(handler); } handler(ownerActivity, e); if (service != null) { service.NotifyHandlerInvoked(); } } } return(e.Result); }
public override bool Evaluate(Activity ownerActivity, IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } ConditionalEventArgs eventArgs = new ConditionalEventArgs(); EventHandler <ConditionalEventArgs>[] eventHandlers = base.GetInvocationList <EventHandler <ConditionalEventArgs> >(CodeCondition.ConditionEvent); IWorkflowDebuggerService workflowDebuggerService = provider.GetService(typeof(IWorkflowDebuggerService)) as IWorkflowDebuggerService; if (eventHandlers != null) { foreach (EventHandler <ConditionalEventArgs> eventHandler in eventHandlers) { if (workflowDebuggerService != null) { workflowDebuggerService.NotifyHandlerInvoking(eventHandler); } eventHandler(ownerActivity, eventArgs); if (workflowDebuggerService != null) { workflowDebuggerService.NotifyHandlerInvoked(); } } } return(eventArgs.Result); }