This dialog is normally used by PolicyActivity to edit rule sets. However, if you want to use a rule set outside of this activity (for example, edit a rule set for use outside of a workflow), you can use this dialog to perform the editing of the rule set.
Public Class RuleSetDialog _ Inherits Form
Dim instance As RuleSetDialog
public class RuleSetDialog : Form
public ref class RuleSetDialog : public Form
public class RuleSetDialog extends Form
To use the dialog box, create an instance and show the dialog. If OK is selected, the property RuleSet contains the RuleSet modified by the user.
To create a RuleSet where the "this" activity is a class of your choosing, and execute the RuleSet if OK is pressed, you could use:
RuleSet ruleSet = null; // no rule set to start with using (RuleSetDialog dialog = new RuleSetDialog(typeof(TestClass), null, ruleSet)) { if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ruleSet = dialog.RuleSet; RuleValidation validation = new RuleValidation(typeof(TestClass), null); RuleEngine engine = new RuleEngine(ruleSet, validation); TestClass testObject = new TestClass(); engine.Execute(testObject); } }
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003