在宿主中动态删除结点:WorkflowChanges
引擎的OnWorkflowIdled事件
Shared Sub OnWorkflowIdled(ByVal sender As Object, ByVal e As WorkflowEventArgs)
Dim 实例 As WorkflowInstance = e.WorkflowInstance
Dim 根 As Activity = 实例.GetWorkflowDefinition()
Dim 修改对象 As WorkflowChanges = New WorkflowChanges(根)
Dim obj As Activity = 修改对象.TransientWorkflow.Activities("挂起")
Dim temp As CompositeActivity = CType(修改对象.TransientWorkflow, CompositeActivity)
temp.Activities.Remove(obj)
实例.ApplyWorkflowChanges(修改对象)
End Sub
Shared Sub OnWorkflowIdled(ByVal sender As Object, ByVal e As WorkflowEventArgs)
Dim 实例 As WorkflowInstance = e.WorkflowInstance
Dim 根 As Activity = 实例.GetWorkflowDefinition()
Dim 修改对象 As WorkflowChanges = New WorkflowChanges(根)
Dim obj As Activity = 修改对象.TransientWorkflow.Activities("挂起")
Dim temp As CompositeActivity = CType(修改对象.TransientWorkflow, CompositeActivity)
temp.Activities.Remove(obj)
实例.ApplyWorkflowChanges(修改对象)
End Sub
本例收于 WWF调试模板(3) 中