RulesManager for WPF
ルールの読み込み、保存、削除
ルールの操作 > ルールの読み込み、保存、削除

Load and Save Rules

RulesManager supports loading and saving rules to an XML file. It allows loading of rule definitions using the Load method of the C1RulesManager class. The Load method takes Stream as parameter to load the rules. Similarly, RulesManager enables saving of the rules definition using the Save method of the C1RulesManager class. The Save method takes Stream as parameter to save the rules.

Delete a Rule

To delete a rule programmatically, use the following code.

C#
コードのコピー
// Remove a rule with a specific expression
var ruleToRemove = rulesManager.Engine.Rules
    .OfType<RulesEngineExpressionRule>()
    .FirstOrDefault(r => r.Expression == "[OrderCount] < 50");
 if (ruleToRemove != null)
 {
     //Code to remove the rule
     rulesManager.Engine.Rules.Remove(ruleToRemove);
 }