Ejemplo n.º 1
0
        public void AddConditionalAction(Func <T, bool> predicate, Action <CodeTriggerActor <T> > setters)
        {
            var actor = new CodeTriggerActor <T>();

            setters(actor);
            var action = new ConditionalCodeTriggerAction <T>(Element, predicate, actor);

            conditionalActions.Add(action);
            action.Apply(null);
        }
Ejemplo n.º 2
0
        protected void OnTrigger(DependencyProperty property)
        {
            var appliedSetters = lastAppliedAction == null ? null : new HashSet <object>();

            foreach (var action in conditionalActions)
            {
                if (action.Apply(appliedSetters))
                {
                    lastAppliedAction?.Unapply(appliedSetters);
                    lastAppliedAction = action;
                    return;
                }
            }
            lastAppliedAction?.Unapply(null);
        }