public void SetState(string targetStateName) { if (targetStateName == null) { throw new ArgumentNullException("targetStateName"); } if (!(this.FindActivityByQualifiedName(targetStateName) is StateActivity)) { throw new ArgumentOutOfRangeException("targetStateName"); } SetStateEventArgs item = new SetStateEventArgs(targetStateName); this.WorkflowInstance.EnqueueItemOnIdle("SetStateQueue", item, null, null); }
internal override void ProcessEvent(ActivityExecutionContext context) { SetStateEventArgs args = context.GetService <WorkflowQueuingService>().GetWorkflowQueue("SetStateQueue").Dequeue() as SetStateEventArgs; StateActivity currentState = StateMachineHelpers.GetCurrentState(context); if (currentState == null) { throw new InvalidOperationException(SR.GetStateMachineWorkflowMustHaveACurrentState()); } StateMachineExecutionState state = StateMachineExecutionState.Get(StateMachineHelpers.GetRootState((StateActivity)context.Activity)); SetStateAction action = new SetStateAction(currentState.QualifiedName, args.TargetStateName); state.EnqueueAction(action); state.ProcessActions(context); }
public void SetState(string targetStateName) { if (targetStateName == null) { throw new ArgumentNullException("targetStateName"); } StateActivity targetState = FindActivityByQualifiedName(targetStateName) as StateActivity; if (targetState == null) { throw new ArgumentOutOfRangeException("targetStateName"); } SetStateEventArgs eventArgs = new SetStateEventArgs(targetStateName); this.WorkflowInstance.EnqueueItemOnIdle(System.Workflow.Activities.StateMachineWorkflowActivity.SetStateQueueName, eventArgs, null, null); }
internal override void ProcessEvent(ActivityExecutionContext context) { WorkflowQueuingService workflowQueuingService = context.GetService <WorkflowQueuingService>(); WorkflowQueue workflowQueue = workflowQueuingService.GetWorkflowQueue(StateMachineWorkflowActivity.SetStateQueueName); SetStateEventArgs eventArgs = workflowQueue.Dequeue() as SetStateEventArgs; StateActivity currentState = StateMachineHelpers.GetCurrentState(context); if (currentState == null) { throw new InvalidOperationException(SR.GetStateMachineWorkflowMustHaveACurrentState()); } StateActivity rootState = StateMachineHelpers.GetRootState((StateActivity)context.Activity); StateMachineExecutionState executionState = StateMachineExecutionState.Get(rootState); SetStateAction action = new SetStateAction(currentState.QualifiedName, eventArgs.TargetStateName); Debug.Assert(!executionState.HasEnqueuedActions); executionState.EnqueueAction(action); executionState.ProcessActions(context); }
/// <exclude /> protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { StateMachineWorkflowInstance instance = WorkflowFacade.GetStateMachineWorkflowInstance(this.WorkflowInstanceId); bool result = Condition.Evaluate(this, executionContext); SetStateEventArgs args; if (result) { args = new SetStateEventArgs(this.TrueTargetStateName); } else { args = new SetStateEventArgs(this.FalseTargetStateName); } // instance.EnqueueItemOnIdle("SetStateQueue", args, null, null); return ActivityExecutionStatus.Closed; }
public void SetState(string targetStateName) { if (targetStateName == null) throw new ArgumentNullException("targetStateName"); StateActivity targetState = FindActivityByQualifiedName(targetStateName) as StateActivity; if (targetState == null) throw new ArgumentOutOfRangeException("targetStateName"); SetStateEventArgs eventArgs = new SetStateEventArgs(targetStateName); this.WorkflowInstance.EnqueueItemOnIdle(System.Workflow.Activities.StateMachineWorkflowActivity.SetStateQueueName, eventArgs, null, null); }