Evaluate() public abstract method

Evaluates the condition.
public abstract Evaluate ( NodeElement conditionNode ) : bool
conditionNode NodeElement /// Condition node information. ///
return bool
Example #1
0
        public override bool Evaluate(ExtensionContext ctx)
        {
            if (!base.Evaluate(ctx))
            {
                return(false);
            }

            ConditionType type = ctx.GetCondition(typeId);

            if (type == null)
            {
                addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context.", null, null, false);
                return(false);
            }

            try
            {
                return(type.Evaluate(node));
            }
            catch (Exception ex)
            {
                addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", null, ex, false);
                return(false);
            }
        }
Example #2
0
        public override bool Evaluate(ExtensionContext ctx)
        {
            if (!base.Evaluate(ctx))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(addin))
            {
                // Make sure the add-in that implements the condition is loaded
                addinEngine.LoadAddin(null, addin, true);
                addin = null;                 // Don't try again
            }

            ConditionType type = ctx.GetCondition(typeId);

            if (type == null)
            {
                addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context.", null, null, false);
                return(false);
            }

            try {
                return(type.Evaluate(node));
            }
            catch (Exception ex) {
                addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", null, ex, false);
                return(false);
            }
        }
Example #3
0
        public override bool Evaluate(ExtensionContext ctx)
        {
            if (!base.Evaluate(ctx))
            {
                return(false);
            }

            if (!string.IsNullOrEmpty(addin))
            {
                // Make sure the add-in that implements the condition is loaded
                addinEngine.LoadAddin(null, addin, true);
                addin = null;                 // Don't try again
            }

            ConditionType type = ctx.GetCondition(typeId);

            if (type == null)
            {
                var parts = string.Join(", ", Array.ConvertAll(node.Attributes, attr => attr.Name + "=" + attr.Value));
                addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context. [" + parts + "]", node.ParentAddinDescription.AddinId, null, false);
                return(false);
            }

            try {
                return(type.Evaluate(node));
            }
            catch (Exception ex) {
                addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", node.ParentAddinDescription.AddinId, ex, false);
                return(false);
            }
        }