Compartir a través de


WorkflowDesignerLoader.AddActivityToDesigner(Activity) Método

Definición

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

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

Parámetros

activity
Activity

Activity que se va a agregar.

Ejemplos

En el ejemplo siguiente se muestra cómo agregar CodeActivity al diseñador. Antes de que la actividad se agregue al diseñador utilizando el método AddActivityToDesigner, se agrega primero a la colección ‘Activities’ de la actividad raíz dentro del flujo de trabajo.

public void AddCodeActivityToDesigner()
{
    WorkflowDesignerLoader loader = GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
    if (loader == null)
        return;

    IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
    CompositeActivity rootActivity = designerHost.RootComponent as CompositeActivity;

    CodeActivity codeActivity = new CodeActivity();
    rootActivity.Activities.Add(codeActivity);
    loader.AddActivityToDesigner(codeActivity);
    return;
}
Public Sub AddCodeActivityToDesigner()

    Dim loader As WorkflowDesignerLoader = CType(GetService(GetType(WorkflowDesignerLoader)), WorkflowDesignerLoader)
    If loader Is Nothing Then Return
    Dim designerHost As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
    Dim rootActivity As CompositeActivity = CType(designerHost.RootComponent, CompositeActivity)
    Dim codeActivity As New CodeActivity()
    rootActivity.Activities.Add(codeActivity)
    loader.AddActivityToDesigner(codeActivity)
    Return
End Sub

Se aplica a