編輯

共用方式為


IfElseBranchActivity Constructors

Definition

Initializes a new instance of the IfElseBranchActivity class.

Overloads

IfElseBranchActivity()

Initializes a new instance of the IfElseBranchActivity class.

IfElseBranchActivity(String)

Initializes a new instance of the IfElseBranchActivity class using the name of the activity.

IfElseBranchActivity()

Initializes a new instance of the IfElseBranchActivity class.

public:
 IfElseBranchActivity();
public IfElseBranchActivity ();
Public Sub New ()

Examples

The following code example shows how to create two new instances of the IfElseBranchActivity class. This code example is part of the Compensation SDK Sample from the PurchaseOrder.cs file. For more information, see Using Compensation.

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

Applies to

IfElseBranchActivity(String)

Initializes a new instance of the IfElseBranchActivity class using the name of the activity.

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)

Parameters

name
String

The user-defined name of the activity.

Applies to