/// <summary>
        /// Initializes a new instance of the <see cref="UvmlStandardEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="eventInfo">The event which is being mutated.</param>
        /// <param name="eventHandler">The event handler to add to the event.</param>
        public UvmlStandardEventHandlerMutator(EventInfo eventInfo, UvmlNode eventHandler)
        {
            Contract.Require(eventInfo, nameof(eventInfo));
            Contract.Require(eventHandler, nameof(eventHandler));

            this.eventInfo = eventInfo;
            this.eventHandler = eventHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlDependencyPropertyBindingMutator"/> class.
        /// </summary>
        /// <param name="dpropID">The property which is being mutated.</param>
        /// <param name="dpropValue">The value to set on the property.</param>
        public UvmlDependencyPropertyBindingMutator(DependencyProperty dpropID, UvmlNode dpropValue)
        {
            Contract.Require(dpropID, nameof(dpropID));
            Contract.Require(dpropValue, nameof(dpropValue));

            this.dpropID    = dpropID;
            this.dpropValue = dpropValue;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlDependencyPropertyBindingMutator"/> class.
        /// </summary>
        /// <param name="dpropID">The property which is being mutated.</param>
        /// <param name="dpropValue">The value to set on the property.</param>
        public UvmlDependencyPropertyBindingMutator(DependencyProperty dpropID, UvmlNode dpropValue)
        {
            Contract.Require(dpropID, nameof(dpropID));
            Contract.Require(dpropValue, nameof(dpropValue));

            this.dpropID = dpropID;
            this.dpropValue = dpropValue;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlStandardPropertyValueMutator"/> class.
        /// </summary>
        /// <param name="propertyInfo">The property which is being mutated.</param>
        /// <param name="propertyValue">The value to set on the property.</param>
        public UvmlStandardPropertyValueMutator(PropertyInfo propertyInfo, UvmlNode propertyValue)
        {
            Contract.Require(propertyInfo, nameof(propertyInfo));
            Contract.Require(propertyValue, nameof(propertyValue));

            this.propertyInfo  = propertyInfo;
            this.propertyValue = propertyValue;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlRoutedEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="revtID">The event which is being mutated.</param>
        /// <param name="revtHandler">The event handler to add to the event.</param>
        public UvmlRoutedEventHandlerMutator(RoutedEvent revtID, UvmlNode revtHandler)
        {
            Contract.Require(revtID, nameof(revtID));
            Contract.Require(revtHandler, nameof(revtHandler));

            this.revtID = revtID;
            this.revtHandler = revtHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlStandardPropertyValueMutator"/> class.
        /// </summary>
        /// <param name="propertyInfo">The property which is being mutated.</param>
        /// <param name="propertyValue">The value to set on the property.</param>
        public UvmlStandardPropertyValueMutator(PropertyInfo propertyInfo, UvmlNode propertyValue)
        {
            Contract.Require(propertyInfo, nameof(propertyInfo));
            Contract.Require(propertyValue, nameof(propertyValue));

            this.propertyInfo = propertyInfo;
            this.propertyValue = propertyValue;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlRoutedEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="revtID">The event which is being mutated.</param>
        /// <param name="revtHandler">The event handler to add to the event.</param>
        public UvmlRoutedEventHandlerMutator(RoutedEvent revtID, UvmlNode revtHandler)
        {
            Contract.Require(revtID, nameof(revtID));
            Contract.Require(revtHandler, nameof(revtHandler));

            this.revtID      = revtID;
            this.revtHandler = revtHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlStandardEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="eventInfo">The event which is being mutated.</param>
        /// <param name="eventHandler">The event handler to add to the event.</param>
        public UvmlStandardEventHandlerMutator(EventInfo eventInfo, UvmlNode eventHandler)
        {
            Contract.Require(eventInfo, nameof(eventInfo));
            Contract.Require(eventHandler, nameof(eventHandler));

            this.eventInfo    = eventInfo;
            this.eventHandler = eventHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlDependencyPropertyValueMutator"/> class.
        /// </summary>
        /// <param name="dpropID">The property which is being mutated.</param>
        /// <param name="dpropValue">The value to set on the property.</param>
        public UvmlDependencyPropertyValueMutator(DependencyProperty dpropID, UvmlNode dpropValue)
        {
            Contract.Require(dpropID, nameof(dpropID));
            Contract.Require(dpropValue, nameof(dpropValue));

            this.dpropID = dpropID;
            this.dpropValue = dpropValue;
            this.dpropSetter = miSetLocalValue.MakeGenericMethod(dpropID.PropertyType);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlDependencyPropertyValueMutator"/> class.
        /// </summary>
        /// <param name="dpropID">The property which is being mutated.</param>
        /// <param name="dpropValue">The value to set on the property.</param>
        public UvmlDependencyPropertyValueMutator(DependencyProperty dpropID, UvmlNode dpropValue)
        {
            Contract.Require(dpropID, nameof(dpropID));
            Contract.Require(dpropValue, nameof(dpropValue));

            this.dpropID     = dpropID;
            this.dpropValue  = dpropValue;
            this.dpropSetter = miSetLocalValue.MakeGenericMethod(dpropID.PropertyType);
        }
Пример #11
0
        /// <summary>
        /// Creates a new mutator from the specified target information.
        /// </summary>
        private static UvmlMutator CreateMutatorForTarget(
            UvmlMutatorTarget targetKind, Type templatedParentType, Type templatedObjectType, Object target, UvmlNode value)
        {
            switch (targetKind)
            {
                case UvmlMutatorTarget.DependencyProperty:
                    return new UvmlDependencyPropertyValueMutator((DependencyProperty)target, value);

                case UvmlMutatorTarget.DependencyPropertyBinding:
                    return new UvmlDependencyPropertyBindingMutator((DependencyProperty)target, value);

                case UvmlMutatorTarget.RoutedEvent:
                    return new UvmlRoutedEventHandlerMutator((RoutedEvent)target, value);

                case UvmlMutatorTarget.StandardProperty:
                    return new UvmlStandardPropertyValueMutator((PropertyInfo)target, value);

                case UvmlMutatorTarget.StandardEvent:
                    return new UvmlStandardEventHandlerMutator((EventInfo)target, value);
            }

            throw new NotSupportedException();
        }