Exemplo n.º 1
0
        private void NotifyChangesCompletedToChildExecutors(IWorkflowCoreRuntime workflowCoreRuntime, Activity contextActivity)
        {
            Queue compositeActivities = new Queue();

            compositeActivities.Enqueue(contextActivity);
            while (compositeActivities.Count > 0)
            {
                CompositeActivity compositeActivity = compositeActivities.Dequeue() as CompositeActivity;
                if (compositeActivity == null || !WorkflowChanges.IsActivityExecutable(compositeActivity))
                {
                    continue;
                }

                ISupportWorkflowChanges compositeActivityExecutor = ActivityExecutors.GetActivityExecutor(compositeActivity) as ISupportWorkflowChanges;
                if (compositeActivityExecutor != null)
                {
                    using (workflowCoreRuntime.SetCurrentActivity(compositeActivity))
                    {
                        using (ActivityExecutionContext executionContext = new ActivityExecutionContext(compositeActivity))
                            compositeActivityExecutor.OnWorkflowChangesCompleted(executionContext);
                    }
                }
                foreach (Activity activity in compositeActivity.Activities)
                {
                    if (activity is CompositeActivity)
                    {
                        compositeActivities.Enqueue(activity);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void NotifyChangesCompletedToChildExecutors(IWorkflowCoreRuntime workflowCoreRuntime, Activity contextActivity)
        {
            Queue queue = new Queue();

            queue.Enqueue(contextActivity);
            while (queue.Count > 0)
            {
                CompositeActivity activity = queue.Dequeue() as CompositeActivity;
                if ((activity != null) && IsActivityExecutable(activity))
                {
                    ISupportWorkflowChanges activityExecutor = ActivityExecutors.GetActivityExecutor(activity) as ISupportWorkflowChanges;
                    if (activityExecutor != null)
                    {
                        using (workflowCoreRuntime.SetCurrentActivity(activity))
                        {
                            using (ActivityExecutionContext context = new ActivityExecutionContext(activity))
                            {
                                activityExecutor.OnWorkflowChangesCompleted(context);
                            }
                        }
                    }
                    foreach (Activity activity2 in activity.Activities)
                    {
                        if (activity2 is CompositeActivity)
                        {
                            queue.Enqueue(activity2);
                        }
                    }
                }
            }
        }