다음을 통해 공유


CompositeActivityDesigner.InsertActivities 메서드

정의

활동을 디자이너에 삽입합니다.

오버로드

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

지정된 위치에서 지정된 활동을 디자이너에 삽입합니다.

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

트랜잭션을 사용하여 지정된 위치에서 활동을 디자이너에 삽입합니다.

InsertActivities(HitTestInfo, ReadOnlyCollection<Activity>)

지정된 위치에서 지정된 활동을 디자이너에 삽입합니다.

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))

매개 변수

insertLocation
HitTestInfo

디자이너에 활동을 삽입할 위치입니다.

activitiesToInsert
ReadOnlyCollection<Activity>

삽입할 활동 목록입니다.

설명

활동 목록을 지정된 위치에 삽입하려면 InsertActivities을 사용합니다.

InsertActivities을 호출하기 전에 지정된 활동을 삽입할 수 있는지 확인하려면 CanInsertActivities를 사용합니다.

적용 대상

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

트랜잭션을 사용하여 지정된 위치에서 활동을 디자이너에 삽입합니다.

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)

매개 변수

compositeActivityDesigner
CompositeActivityDesigner

활동이 삽입될 디자이너입니다.

insertLocation
HitTestInfo

활동이 삽입될 디자이너의 위치입니다.

activitiesToInsert
ReadOnlyCollection<Activity>

삽입할 활동 목록입니다.

undoTransactionDescription
String

삽입을 통해 생성된 디자이너 트랜잭션의 설명입니다.

예제

다음 예제에서는 CompositeActivityDesigner 클래스에 기반을 둔 디자이너를 사용하여 새 분기를 추가하는 방법을 보여 줍니다. CanInsertActivities가 true를 반환할 경우에는 새 분기는 InsertActivities 메서드를 사용하여 만들어집니다.

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

설명

활동 목록을 복합 활동에 삽입하려면 InsertActivities를 사용합니다.

InsertActivities를 호출하기 전에 지정된 활동 목록을 삽입할 수 있는지 확인하려면 CanInsertActivities를 사용합니다.

적용 대상