Edytuj

Udostępnij za pośrednictwem


IfElseBranchActivity.Condition Property

Definition

Gets or sets an ActivityCondition object reference for the current branch activity. The evaluation of this condition returns a value that indicates whether this branch should be run.

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

Property Value

An ActivityCondition that returns a value that indicates whether this branch should be run.

Examples

The following code example shows how to set the Condition property. This code assumes that Available is of type IfElseBranchActivity. This code example is part of the Compensation SDK Sample from the PurchaseOrder.cs file. For more information, see Using Compensation.

public void LoadLayout()
{
    using (XmlReader reader = XmlReader.Create("wfInstanceId.designer.xml"))
    {
        IList layoutLoadErrors = new ArrayList() as IList;
        this.LoadDesignerLayout(reader, out layoutLoadErrors);

        if (layoutLoadErrors.Count > 0)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder("Errors:\r\n");
            foreach (WorkflowMarkupSerializationException error in layoutLoadErrors)
            {
                sb.Append(error.Message + "\r\n");
            }
            MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
Public Sub LoadLayout()
    Using reader As XmlReader = XmlReader.Create("wfInstanceId.designer.xml")

        Dim layoutLoadErrors As IList = CType(New ArrayList(), IList)
        Me.LoadDesignerLayout(reader, layoutLoadErrors)

        If layoutLoadErrors.Count > 0 Then
            Dim sb As New System.Text.StringBuilder("Errors:\r\n")
            For Each errorMessage As WorkflowMarkupSerializationException In layoutLoadErrors
                sb.Append(errorMessage.Message + "\r\n")
            Next
            MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End If
    End Using
End Sub

Remarks

This property is optional on the last IfElseBranchActivity in the IfElseActivity and required in other cases.

Applies to