CompositeActivityDesigner.InsertActivities Method

Definition

Inserts activities into the designer.

Overloads

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

Inserts the specified activities in the designer at the specified location.

InsertActivities(CompositeActivityDesigner, HitTestInfo, ReadOnlyCollection<Activity>, String)

Inserts activities into the designer at the specified location using a transaction.

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

Inserts the specified activities in the designer at the specified location.

public virtual void InsertActivities(System.Workflow.ComponentModel.Design.HitTestInfo insertLocation, System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> activitiesToInsert);

Parameters

insertLocation
HitTestInfo

The location in the designer to insert the activities.

activitiesToInsert
ReadOnlyCollection<Activity>

The list of activities to insert.

Remarks

Use InsertActivities to insert a list of activities into the location specified.

Prior to calling InsertActivities, use CanInsertActivities to make sure that the specified activities can be inserted.

Applies to

.NET Framework 4.8.1 i inne wersje
Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

InsertActivities(CompositeActivityDesigner, HitTestInfo, ReadOnlyCollection<Activity>, String)

Inserts activities into the designer at the specified location using a transaction.

public static void InsertActivities(System.Workflow.ComponentModel.Design.CompositeActivityDesigner compositeActivityDesigner, System.Workflow.ComponentModel.Design.HitTestInfo insertLocation, System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> activitiesToInsert, string undoTransactionDescription);

Parameters

compositeActivityDesigner
CompositeActivityDesigner

The designer into which the activities will be inserted.

insertLocation
HitTestInfo

The location in the designer at which the activities will be inserted.

activitiesToInsert
ReadOnlyCollection<Activity>

The list of activities to insert.

undoTransactionDescription
String

Description for the designer transaction created by the insertion.

Examples

The following example demonstrates the addition of a new branch using a designer based off of the CompositeActivityDesigner class. If CanInsertActivities returns true, a new branch is created using the InsertActivities method.

protected override CompositeActivity OnCreateNewBranch()
{
    return new ParallelIfBranch();
}

private void OnAddBranch(object sender, EventArgs e)
{
    CompositeActivity activity1 = this.OnCreateNewBranch();
    CompositeActivity activity2 = base.Activity as CompositeActivity;

    if ((activity2 != null) && (activity1 != null))
    {
        int num1 = this.ContainedDesigners.Count;
        Activity[] activityArray1 = new Activity[] { activity1 };

        if (CanInsertActivities(new ConnectorHitTestInfo(this, HitTestLocations.Designer, activity2.Activities.Count),
            new List<Activity>(activityArray1).AsReadOnly()))
        {
            CompositeActivityDesigner.InsertActivities(this,
                new ConnectorHitTestInfo(this, HitTestLocations.Designer, activity2.Activities.Count),
                new List<Activity>(activityArray1).AsReadOnly(),
                string.Format("Adding branch {0}", activity1.GetType().Name));

            if ((this.ContainedDesigners.Count > num1) && (this.ContainedDesigners.Count > 0))
            {
                this.ContainedDesigners[this.ContainedDesigners.Count - 1].EnsureVisible();
            }
        }
    }
}

Remarks

Use InsertActivities to insert a list of activities into the composite activity.

Prior to calling InsertActivities, use CanInsertActivities to make sure the specified list of activities can be inserted.

Applies to

.NET Framework 4.8.1 i inne wersje
Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1