Compartir a través de


WorkflowDesignerLoader.RemoveActivityFromDesigner(Activity) Método

Definición

Quita una actividad del host del diseñador una vez agregada a la colección de actividades primaria.

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)

Parámetros

activity
Activity

Actividad que se va a quitar del diseñador.

Ejemplos

En el siguiente ejemplo se muestra cómo quitar una actividad de WorkflowDesignerLoader. Antes de que la última actividad secundaria en el flujo de trabajo se quite de WorkflowDesignerLoader, se quita primero de la colección del flujo de trabajo 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

Se aplica a