StructuredCompositeActivityDesigner.ContainedDesigners 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得泛型唯讀集合,其中包含 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)
屬性值
ActivityDesigner 唯讀集合,包含子設計工具。
範例
下列範例將示範如何使用 CompositeActivityDesigner 類別以外的設計工具,加入新的分支。 如果 CanInsertActivities 傳回 true,就會使用 InsertActivities 方法來建立新的分支。 建立 ConnectorHitTestInfo 物件並做為參數傳到 InsertActivities 方法。 當結束時,EnsureVisibleContainedDesigner 方法會藉由存取 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