Condividi tramite


StructuredCompositeActivityDesigner.ContainedDesigners Proprietà

Definizione

Ottiene una raccolta generica di sola lettura contenente tutti gli ActivityDesigner figlio dell'oggetto StructuredCompositeActivityDesigner.

public:
 virtual property System::Collections::ObjectModel::ReadOnlyCollection<System::Workflow::ComponentModel::Design::ActivityDesigner ^> ^ ContainedDesigners { System::Collections::ObjectModel::ReadOnlyCollection<System::Workflow::ComponentModel::Design::ActivityDesigner ^> ^ get(); };
public override System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Design.ActivityDesigner> ContainedDesigners { get; }
member this.ContainedDesigners : System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.ComponentModel.Design.ActivityDesigner>
Public Overrides ReadOnly Property ContainedDesigners As ReadOnlyCollection(Of ActivityDesigner)

Valore della proprietà

Raccolta di sola lettura di ActivityDesigner contenente le finestre di progettazione figlio.

Esempio

Nell'esempio seguente viene illustrata l'aggiunta di un nuovo ramo utilizzando una finestra di progettazione basata sulla classe CompositeActivityDesigner. Se CanInsertActivities restituisce True, viene creato un nuovo ramo mediante il metodo InsertActivities. L'oggetto ConnectorHitTestInfo viene creato come parametro del metodo InsertActivities. Al termine, viene utilizzato il metodo EnsureVisibleContainedDesigner per garantire la visualizzazione, nella finestra di progettazione del flusso di lavoro, del nuovo ramo aggiunta accedendo a un singolo oggetto contenuto nella raccolta di ContainedDesigners.

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

Si applica a