Esempio n. 1
0
 public override Rule ToRule(EventSlot slot)
 {
     var rule = new AlwaysRule();
     foreach (var activityModel in Activities)
     {
         rule.Activities.Add(activityModel.ToConfiguredActivity());
     }
     return rule;
 }
Esempio n. 2
0
        public override Rule ToRule(EventSlot slot)
        {
            var rule = new IfElseRule();
            rule.Conditions = Conditions.ToList();

            foreach (var thenRuleModel in Then)
            {
                rule.Then.Add(thenRuleModel.ToRule(slot));
            }

            foreach (var elseRuleModel in Else)
            {
                rule.Else.Add(elseRuleModel.ToRule(slot));
            }

            return rule;
        }
Esempio n. 3
0
        public override Rule ToRule(EventSlot slot)
        {
            var param = RuleParameterProviders.Providers.GetParameter(slot.EventType, Parameter);
            var rule = new SwitchCaseRule(param);

            foreach (var caze in Cases)
            {
                var value = Convert.ChangeType(caze.Value, param.ValueType);
                rule.Cases.Add(value, caze.Rules.Select(r => r.ToRule(slot)).ToList());
            }

            foreach (var defaultRule in Default)
            {
                rule.Default.Add(defaultRule.ToRule(slot));
            }

            return rule;
        }
Esempio n. 4
0
        public void Register(string group, Type eventType, string shortName = null)
        {
            var slot = new EventSlot(eventType, shortName);

            slot.Initialize();

            _slotsByEventNames.Add(eventType.Name, slot);

            if (!_slotsByGroups.ContainsKey(group))
            {
                _slotsByGroups.Add(group, new List <EventSlot> {
                    slot
                });
            }
            else
            {
                _slotsByGroups[group].Add(slot);
            }
        }
Esempio n. 5
0
 public abstract Rule ToRule(EventSlot slot);
Esempio n. 6
0
 public RulesFileFormat(EventSlot slot)
 {
     Slot = slot;
 }