You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application contains a state workflow.
You write the following code segment.
WorkflowRuntime runtime = new WorkflowRuntime();
WorkflowInstance instance = runtime.CreateWorkflow(
typeof(DynamicUpdateWorkflow));
instance.Start();
StateMachineWorkflowInstance smwi =
new StateMachineWorkflowInstance(runtime,
instance.InstanceId);
A dependency property named Status is defined in this workflow.
The value of a variable named amount is used to set the state of the workflow. You need to ensure that the host application changes the state of the workflow on the basis of the value of the amount variable.
What are the two possible code segments that you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A.
if (amount >= 1000) smwi.SetState("HighValueState");else smwi.SetState("LowValueState");
B.
if (amount >= 1000) smwi.StateMachineWorkflow.SetValue
(DynamicUpdateWorkflow.StatusProperty,"HighValueState")else smwi.StateMachineWorkflow.SetValue (DynamicUpdateWorkflow.StatusProperty, "LowValueState");
C.
if (amount >= 1000) instance.GetWorkflowDefinition().SetValue (DynamicUpdateWorkflow.StatusProperty,"HighValueState");else instance.GetWorkflowDefinition().SetValue (DynamicUpdateWorkflow.StatusProperty,"LowValueState");
D.
if (amount >= 1000){ StateActivity high = (StateActivity) smwi.StateMachineWorkflow.Activities["HighValueState"]; smwi.SetState(high);}else{ StateActivity low = (StateActivity) smwi.StateMachineWorkflow.Activities["LowValueState"]; smwi.SetState(low);}