WorkflowWindowsFormsModule.QueryAvailableActivities Event

Occurs prior to loading the rehosted workflow designer.

Namespace: DevExpress.ExpressApp.Workflow.Win

Assembly: DevExpress.ExpressApp.Workflow.Win.v18.1.dll

Declaration

public event EventHandler<ActivitiesInformationEventArgs> QueryAvailableActivities
Public Event QueryAvailableActivities As EventHandler(Of ActivitiesInformationEventArgs)

The event handler receives an argument of the ActivitiesInformationEventArgs type. The ActivitiesInformationEventArgs properties provide information specific to this event.

Handle this event to customize the list of activities that will be available in the rehosted workflow designer's toolbox. The following code snippet demonstrates how to remove a MyActivity activity from the toolbox.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Workflow;
using DevExpress.ExpressApp.Workflow.Win;
//...
public class MyWindowController : WindowController {
    WorkflowWindowsFormsModule workflowModuleWin;
    protected override void OnActivated() {
        base.OnActivated();
        workflowModuleWin = Application.Modules.FindModule<WorkflowWindowsFormsModule>();
        if (workflowModuleWin != null)
            workflowModuleWin.QueryAvailableActivities += OnQueryAvailableActivities;
    }
    void OnQueryAvailableActivities(object sender, ActivitiesInformationEventArgs e) {
        ActivityInformation myActivity = 
            e.ActivitiesInformation.Find(i => i.DisplayName == "MyActivity");
        e.ActivitiesInformation.Remove(myActivity);
    }
    protected override void OnDeactivated() {
        if (workflowModuleWin != null) {
            workflowModuleWin.QueryAvailableActivities -= OnQueryAvailableActivities;
            workflowModuleWin = null;
        }
        base.OnDeactivated();
    }
}

To see an example of handling this event to add new activities to the toolbox, refer to the Add Activities to the Workflow Designer Toolbox help topic.

See Also