public ConditionManager(Condition condition, IMastAdapter mastInterface) { if (condition == null) { throw new NullReferenceException("Condition must not be null"); } if (mastInterface == null) { throw new NullReferenceException("IMastAdapter must not be null."); } Condition = condition; MastInterface = mastInterface; if (condition.type == ConditionType.@event) { eventHandler = ReflectionHelper.AttachEvent(MastInterface, condition.name, this, "OnEventFired"); } //Wire up our child conditions. Note - only top level conditions can be based on events, or things would get weird. foreach (Condition c in Condition.condition) { if (c.type == ConditionType.@event) { throw new Exception("Event classed conditions can not be children"); } ConditionManager cm = new ConditionManager(c, MastInterface) { ParentCondition = this }; Children.Add(cm); } }