IfElseBranchActivity 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 IfElseBranchActivity 類別的新執行個體。
多載
IfElseBranchActivity() |
初始化 IfElseBranchActivity 類別的新執行個體。 |
IfElseBranchActivity(String) |
使用活動的名稱,初始化 IfElseBranchActivity 類別的新執行個體。 |
IfElseBranchActivity()
初始化 IfElseBranchActivity 類別的新執行個體。
public:
IfElseBranchActivity();
public IfElseBranchActivity ();
Public Sub New ()
範例
下列程式碼範例示範如何建立 IfElseBranchActivity 類別的兩個新執行個體。 這個程式碼範例是 PurchaseOrder.cs 檔案中<補償 SDK>範例的一部分。 如需詳細資訊,請參閱 使用補償。
public void SaveLayout()
{
using (XmlWriter writer = XmlWriter.Create("wfInstanceId.designer.xml"))
{
IList layoutSaveErrors = new ArrayList() as IList;
IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
ActivityDesigner rootDesigner = host.GetDesigner(host.RootComponent) as ActivityDesigner;
this.SaveDesignerLayout(writer, rootDesigner, out layoutSaveErrors);
if (layoutSaveErrors.Count > 0)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder("Errors:\r\n");
foreach (WorkflowMarkupSerializationException error in layoutSaveErrors)
{
sb.Append(error.Message + "\r\n");
}
MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
Public Sub SaveLayout()
Using writer As XmlWriter = XmlWriter.Create("wfInstanceId.designer.xml")
Dim layoutSaveErrors As IList = CType(New ArrayList(), IList)
Dim host As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
Dim rootDesigner As ActivityDesigner = CType(host.GetDesigner(host.RootComponent), ActivityDesigner)
Me.SaveDesignerLayout(writer, rootDesigner, layoutSaveErrors)
If layoutSaveErrors.Count > 0 Then
Dim sb As New System.Text.StringBuilder("Errors:\r\n")
For Each errorMessage As WorkflowMarkupSerializationException In layoutSaveErrors
sb.Append(errorMessage.Message + "\r\n")
Next
MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Using
End Sub
適用於
IfElseBranchActivity(String)
使用活動的名稱,初始化 IfElseBranchActivity 類別的新執行個體。
public:
IfElseBranchActivity(System::String ^ name);
public IfElseBranchActivity (string name);
new System.Workflow.Activities.IfElseBranchActivity : string -> System.Workflow.Activities.IfElseBranchActivity
Public Sub New (name As String)
參數
- name
- String
使用者定義的活動名稱。