protected virtual void OnAfterEval(AfterEvalEventArgs args) { EventHandler<AfterEvalEventArgs> handler = AfterEval; if (handler != null) handler(this, args); }
//......................................................................... public virtual object Eval(object o) { object result = null; BeforeEvalEventArgs args = new BeforeEvalEventArgs(o); OnBeforeEval(args); if (!args.Cancel && args.Eval != null) { Exception e = null; try { result = Interpreter.Eval(args.Eval); Debug(result); } catch (Exception ex) { e = ex; Debug(FormatException(ex)); if (result == null) result = ex; } AfterEvalEventArgs args2 = new AfterEvalEventArgs(args.Eval, result, e); OnAfterEval(args2); /*if (e != null && !(e is LispException) && !args2.ExceptionHandled) throw e;*/ } return result; }