コード例 #1
0
        internal override void Execute(ActivityExecutionContext context)
        {
            base.Execute(context);
            StateActivity         rootState = StateMachineHelpers.GetRootState(base.State);
            Queue <StateActivity> queue     = new Queue <StateActivity>();

            queue.Enqueue(rootState);
            while (queue.Count > 0)
            {
                foreach (Activity activity3 in queue.Dequeue().EnabledActivities)
                {
                    EventDrivenActivity eventDriven = activity3 as EventDrivenActivity;
                    if (eventDriven != null)
                    {
                        IComparable queueName = StateMachineHelpers.GetEventActivity(eventDriven).QueueName;
                        if (queueName != null)
                        {
                            WorkflowQueue workflowQueue = StateMachineSubscriptionManager.GetWorkflowQueue(context, queueName);
                            if (workflowQueue != null)
                            {
                                workflowQueue.Enabled = base.SubscriptionManager.Subscriptions.ContainsKey(queueName);
                            }
                        }
                    }
                    else
                    {
                        StateActivity item = activity3 as StateActivity;
                        if (item != null)
                        {
                            queue.Enqueue(item);
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal override void Execute(ActivityExecutionContext context)
        {
            base.Execute(context);

            StateActivity         state     = this.State;
            StateActivity         rootState = StateMachineHelpers.GetRootState(state);
            Queue <StateActivity> states    = new Queue <StateActivity>();

            states.Enqueue(rootState);
            while (states.Count > 0)
            {
                state = states.Dequeue();
                foreach (Activity activity in state.EnabledActivities)
                {
                    EventDrivenActivity eventDriven = activity as EventDrivenActivity;
                    if (eventDriven != null)
                    {
                        IEventActivity eventActivity = StateMachineHelpers.GetEventActivity(eventDriven);
                        IComparable    queueName     = eventActivity.QueueName;
                        if (queueName != null)
                        {
                            WorkflowQueue queue = StateMachineSubscriptionManager.GetWorkflowQueue(context, queueName);
                            if (queue != null)
                            {
                                queue.Enabled = this.SubscriptionManager.Subscriptions.ContainsKey(queueName);
                            }
                        }
                    }
                    else
                    {
                        StateActivity childState = activity as StateActivity;
                        if (childState != null)
                        {
                            states.Enqueue(childState);
                        }
                    }
                }
            }
        }