Пример #1
0
        private static IEnumerable <RuleViewModelBase> TraverseRulesTree(this RuleParentViewModelBase parent)
        {
            foreach (var rule in parent.Rules)
            {
                yield return(rule);

                var ruleParent = rule as RuleParentViewModelBase;
                if (ruleParent == null)
                {
                    continue;
                }

                foreach (var childRule in ruleParent.TraverseRulesTree())
                {
                    yield return(childRule);
                }
            }
        }
Пример #2
0
 public static bool IsParentOf(this RuleParentViewModelBase ruleParent, RuleViewModelBase rule)
 {
     return(ruleParent.TraverseRulesTree()
            .Any(r => r == rule));
 }
Пример #3
0
 public RuleViewModelBase Create(IRule rule, RuleParentViewModelBase parent)
 {
     return(_typeActivators[rule.GetType()](rule, parent));
 }