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.
Assembly: System.Workflow.Activities (in System.Workflow.Activities.dll)
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 you want to use, and execute the condition if OK is pressed, you could use:
// Start with no expression.
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.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
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.