Export (0) Print
Expand All

RuleConditionDialog Class

This dialog is normally used by the activities IfElseBranchActivity, WhileActivity, ConditionedActivityGroup and ReplicatorActivity to edit declarative conditions. However, if you want to use conditions outside of these activities (for example, edit a condition for use outside of a workflow completely), you can use this dialog to perform the editing of the condition.

Namespace: System.Workflow.Activities.Rules.Design
Assembly: System.Workflow.Activities (in system.workflow.activities.dll)

public class RuleConditionDialog : Form
public class RuleConditionDialog extends Form
public class RuleConditionDialog extends Form
Not applicable.

To use the dialog box, create an instance and show the dialog. If OK is selected, the property Expression contains the CodeExpression entered by the user.

For example, to create a CodeExpression where the "this" activity is a class of your choosing, and execute the condition if OK is pressed, you could use:

    // No expression to start with
    CodeExpression expression = null;

    using (RuleConditionDialog dialog = new RuleConditionDialog(typeof(TestClass), null, expression))
    {
        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            expression = dialog.Expression;
            RuleExpressionCondition condition = new RuleExpressionCondition(expression);
            RuleValidation validation = new RuleValidation(typeof(TestClass), null);
            if (condition.Validate(validation))
            {
                RuleValidation execution = new RuleExecution(validation, new TestClass());
                Console.WriteLine("Expression evaluates to " + condition.Evaluate(execution));
            }
        }
    }

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ScrollableControl
           System.Windows.Forms.ContainerControl
             System.Windows.Forms.Form
              System.Workflow.Activities.Rules.Design.RuleConditionDialog

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft