CompositeActivityDesigner.InsertActivities Methode

Definition

Fügt Aktivitäten in den Designer ein.Inserts activities into the designer.

Überlädt

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

Fügt die angegebenen Aktivitäten am angegebenen Ort in den Designer ein.Inserts the specified activities in the designer at the specified location.

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

Fügt Aktivitäten mithilfe einer Transaktion am angegebenen Ort in den Designer ein.Inserts activities into the designer at the specified location using a transaction.

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

Fügt die angegebenen Aktivitäten am angegebenen Ort in den Designer ein.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);
public virtual void InsertActivities (System.Workflow.ComponentModel.Design.HitTestInfo insertLocation, System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> activitiesToInsert);
abstract member InsertActivities : System.Workflow.ComponentModel.Design.HitTestInfo * System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> -> unit
override this.InsertActivities : System.Workflow.ComponentModel.Design.HitTestInfo * System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> -> unit
Public Overridable Sub InsertActivities (insertLocation As HitTestInfo, activitiesToInsert As ReadOnlyCollection(Of Activity))

Parameter

insertLocation
HitTestInfo

Der Ort im Designer, an dem die Aktivitäten eingefügt werden.The location in the designer to insert the activities.

activitiesToInsert
ReadOnlyCollection<Activity>

Die Liste der einzufügenden Aktivitäten.The list of activities to insert.

Hinweise

Verwenden Sie InsertActivities zum Einfügen einer Liste der Aktivitäten am angegebenen Ort.Use InsertActivities to insert a list of activities into the location specified.

Vor dem Aufrufen von InsertActivities verwenden Sie CanInsertActivities, um sicherzustellen, dass die angegebenen Aktivitäten eingefügt werden können.Prior to calling InsertActivities, use CanInsertActivities to make sure that the specified activities can be inserted.

Gilt für:

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

Fügt Aktivitäten mithilfe einer Transaktion am angegebenen Ort in den Designer ein.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, System::String ^ undoTransactionDescription);
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);
static member InsertActivities : System.Workflow.ComponentModel.Design.CompositeActivityDesigner * System.Workflow.ComponentModel.Design.HitTestInfo * System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Activity> * string -> unit
Public Shared Sub InsertActivities (compositeActivityDesigner As CompositeActivityDesigner, insertLocation As HitTestInfo, activitiesToInsert As ReadOnlyCollection(Of Activity), undoTransactionDescription As String)

Parameter

compositeActivityDesigner
CompositeActivityDesigner

Der Designer, in den die Aktivitäten eingefügt werden.The designer into which the activities will be inserted.

insertLocation
HitTestInfo

Der Ort im Designer, an dem die Aktivitäten eingefügt werden.The location in the designer at which the activities will be inserted.

activitiesToInsert
ReadOnlyCollection<Activity>

Die Liste der einzufügenden Aktivitäten.The list of activities to insert.

undoTransactionDescription
String

Beschreibung für die von der Einfügung erstellte Designertransaktion.Description for the designer transaction created by the insertion.

Beispiele

Das folgende Beispiel veranschaulicht das Hinzufügen einer neuen Verzweigung mit einem Designer, der auf der CompositeActivityDesigner-Klasse basiert.The following example demonstrates the addition of a new branch using a designer based off of the CompositeActivityDesigner class. Wenn CanInsertActivities true zurückgibt, wird eine neue Verzweigung mithilfe der InsertActivities-Methode erstellt.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();
            }
        }
    }
}
Protected Overrides Function OnCreateNewBranch() As CompositeActivity
    Return New ParallelIfBranch()
End Function

Private Sub OnAddBranch(ByVal sender As Object, ByVal e As EventArgs)
    Dim activity1 As CompositeActivity = Me.OnCreateNewBranch()
    Dim activity2 As CompositeActivity = CType(MyBase.Activity, CompositeActivity)

    If (activity2 IsNot Nothing) And (activity1 IsNot Nothing) Then

        Dim num1 As Integer = Me.ContainedDesigners.Count
        Dim activityArray1() As Activity = {activity1}

        If (CanInsertActivities(New ConnectorHitTestInfo(Me, HitTestLocations.Designer, activity2.Activities.Count), _
            New List(Of Activity)(activityArray1).AsReadOnly())) Then

            CompositeActivityDesigner.InsertActivities(Me, _
                New ConnectorHitTestInfo(Me, HitTestLocations.Designer, activity2.Activities.Count), _
                New List(Of Activity)(activityArray1).AsReadOnly(), _
                String.Format("Adding branch 0}", activity1.GetType().Name))

            If (Me.ContainedDesigners.Count > num1) And (Me.ContainedDesigners.Count > 0) Then
                Me.ContainedDesigners(Me.ContainedDesigners.Count - 1).EnsureVisible()
            End If
        End If
    End If
End Sub

Hinweise

Verwenden Sie InsertActivities zum Einfügen einer Liste von Aktivitäten in die zusammengesetzte Aktivität.Use InsertActivities to insert a list of activities into the composite activity.

Vor dem Aufrufen von InsertActivities verwenden Sie CanInsertActivities, um sicherzustellen, dass die angegebene Liste der Aktivitäten eingefügt werden kann.Prior to calling InsertActivities, use CanInsertActivities to make sure the specified list of activities can be inserted.

Gilt für: