共用方式為


WorkflowView.RootDesigner 屬性

定義

取得或設定 WorkflowView 的根目錄設計工具。

public:
 property System::Workflow::ComponentModel::Design::ActivityDesigner ^ RootDesigner { System::Workflow::ComponentModel::Design::ActivityDesigner ^ get(); void set(System::Workflow::ComponentModel::Design::ActivityDesigner ^ value); };
public System.Workflow.ComponentModel.Design.ActivityDesigner RootDesigner { get; set; }
member this.RootDesigner : System.Workflow.ComponentModel.Design.ActivityDesigner with get, set
Public Property RootDesigner As ActivityDesigner

屬性值

ActivityDesigner 關聯的 WorkflowView

範例

下列範例將示範如何取得 WorkflowView 物件的 RootDesigner。 workflowPanel 欄位包含了一個名為 GetWorkflowView 的方法,可以傳回現有的 WorkflowView 執行個體。 接著 RootDesigner 便在尚未有任何動作發生之前轉型為 SequentialWorkflowRootDesigner。

這個程式碼範例是 DesignerShell.cs 檔案中 Basic DesignerHosting SDK 範例的一部分。 如需詳細資訊,請參閱 基本設計工具裝載範例

private void addButton_Click(object sender, EventArgs e)
{
    SequentialWorkflowRootDesigner rootDesigner = this.workflowPanel.GetWorkflowView().RootDesigner as SequentialWorkflowRootDesigner;
    int viewId = rootDesigner.ActiveView.ViewId;
    if (viewId == 1)
    {
        this.workflowPanel.OnCodeActivityAdded();
    }
    else
    {
        DialogResult resultBox = MessageBox.Show("This sample supports adding a code activity only in workflow view");
    }
}
Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click
    Dim viewId As Integer
    Dim rootDesigner As SequentialWorkflowRootDesigner
    rootDesigner = Me.workflowPanel.GetWorkflowView().RootDesigner
    viewId = rootDesigner.ActiveView.ViewId
    If viewId = 1 Then
        Me.workflowPanel.OnCodeActivityAdded()
    Else
        Dim resultBox As DialogResult
        resultBox = MessageBox.Show("This sample supports adding a code activity only in workflow view")
    End If
End Sub

備註

工作流程的根目錄設計工具是與工作流程設計介面關聯的設計工具。 它包含了所有子設計工具與工作流程中後續的所有活動。

適用於