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.

C#
public System.Workflow.ComponentModel.ActivityCondition Condition { get; set; }

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.

C#
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);
        }
    }
}

Remarks

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

Applies to

Produkt Wersje
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1