다음을 통해 공유


WorkflowDesignerLoader.RemoveActivityFromDesigner(Activity) 메서드

정의

활동이 부모 활동 컬렉션에 추가되면 디자이너 호스트에서 활동을 제거합니다.

public:
 void RemoveActivityFromDesigner(System::Workflow::ComponentModel::Activity ^ activity);
public void RemoveActivityFromDesigner (System.Workflow.ComponentModel.Activity activity);
member this.RemoveActivityFromDesigner : System.Workflow.ComponentModel.Activity -> unit
Public Sub RemoveActivityFromDesigner (activity As Activity)

매개 변수

activity
Activity

디자이너에서 제거할 활동입니다.

예제

다음 예제에서는 WorkflowDesignerLoader에서 활동을 제거하는 방법을 보여 줍니다. 워크플로의 마지막 자식 활동은 WorkflowDesignerLoader에서 제거되기 전에 먼저 워크플로 Activities 컬렉션에서 제거됩니다.

public void RemoveLastChildActivity()
{
    IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
    CompositeActivity rootActivity = designerHost.RootComponent as CompositeActivity;

    if (rootActivity.Activities.Count > 0)
    {
        Activity activityToRemove = rootActivity.Activities[rootActivity.Activities.Count - 1];
        rootActivity.Activities.Remove(activityToRemove);
        this.RemoveActivityFromDesigner(activityToRemove);
    }
}
Public Sub RemoveLastChildActivity()
    Dim designerHost As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
    Dim rootActivity As CompositeActivity = CType(designerHost.RootComponent, CompositeActivity)

    If rootActivity.Activities.Count > 0 Then
        Dim activityToRemove As Activity = rootActivity.Activities(rootActivity.Activities.Count - 1)
        rootActivity.Activities.Remove(activityToRemove)
        Me.RemoveActivityFromDesigner(activityToRemove)
    End If
End Sub

적용 대상