ProcessElementDelegate Delegate
Defines the signature (the parameters and the return value) of the application-defined method which can be used as a filter which triggers when a rule condition gets satisfied and controls whether to perform the action defined by this rule.

Namespace: MailBee.Html
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public delegate bool ProcessElementDelegate(
	Element elem,
	Rule rule


Type: MailBee.HtmlElement
The element which satisfied conditions of the rule.
Type: MailBee.HtmlRule
The rule which was satisfied.

Return Value

Type: Boolean
Should return true to tell MailBee to apply the action associated with the rule for which this delegate was called, or false to ignore this rule and continue. Has no effect on rules of ProcessingCondition type.

This delegate defines a pattern for the callback method MailBee executes when it encounters any matches of HTML processing rule conditions with particular HTML elements. You can implement any custom processing in this method, modify the given HTML element, or decide whether the rule should be applied by returning true of false.

Process(RuleSet, ProcessElementDelegate) method, while being running, executes a delegate method every time when any of the rules gets satisfied. This happens when the rule condition matches a particular HTML tag (for instance, you're using a rule which applies to all <A> tags with HREF attributes and Process(RuleSet, ProcessElementDelegate) method encountered such a tag).

Process(RuleSet, ProcessElementDelegate) method then executes the delegate passing a reference to the matching Element. The delegate method should examine the supplied element and return either true to let MailBee apply the rule action to this element or false to ignore it. The return value of the delegate, however, does not affect whether Process(RuleSet, ProcessElementDelegate) method will continue processing of subsequent elements of the document. To make Process(RuleSet, ProcessElementDelegate) method completely stop processing of the current document, call Stop method for the same object you earlier called Process(RuleSet, ProcessElementDelegate) for.

Rules of all types (defined in TagRuleTypes enumeration) cause the delegate be executed. Moreover, ProcessingCondition rule does not perform any actions except calling the delegate itself.

See Also