Esempio n. 1
0
        /// <summary>
        /// This implementation creates copies of the source condition and the target action configured
        /// for <paramref name="view"/>, and registeres the target copy as a listener for the source copy's
        /// <see cref="ICondition.ConditionTriggered"/> event.
        /// </summary>
        /// <param name="view">The view where to install this constraint.</param>
        /// <returns>A correctly configured copy of the original constraint</returns>
        public IConstraint InstallInView(IModelView view)
        {
            ICondition newSrc    = sourceCondition.InstallInView(view);
            IAction    newAction = targetAction.InstallInView(view);

            if (newSrc != null && newAction != null)
            {
                //for now, just wire condition and action together
                newSrc.ConditionTriggered += newAction.PerformAction;
                //force value check!
                newSrc.SourceValueChangedHandler(null, null);
                //return new holder instance...
                return(new ConditionActionConstraint(newSrc, newAction));
            }
            return(null);
        }