private ConditionalNode CreateConditionalNode(ConditionalExpression node) { var test = Expression.Lambda <Func <bool> >(node.Test).Compile(); ConditionalNode conditionalNode; switch (_context.ConditionalNodeType) { case ConditionalNodeType.None: case ConditionalNodeType.Test: conditionalNode = new ConditionalNode(test, true); break; case ConditionalNodeType.IfTrue: conditionalNode = new ConditionalNode(test); _context.ConditionalNode.IfTrueChild = conditionalNode; break; case ConditionalNodeType.IfFalse: conditionalNode = new ConditionalNode(test); _context.ConditionalNode.IfFalseChild = conditionalNode; break; default: throw new ArgumentOutOfRangeException(); } return(conditionalNode); }
private static void UpdateInternal(ConditionalNode child, IEnumerable <DependencyNode> nodes, bool activate) { if (child != null) { child.Update(activate); } else { nodes.ForEach(item => item.IsActivated = activate); } }