Ejemplo n.º 1
0
        private void OnChangedPropertyEvent(object sender, ChangedPropertyEventArgs e)
        {
            //Component id was changed
            if (typeof(CommandServiceComponent).IsAssignableFrom(e.PropertyReference.SourceType) &&
                e.PropertyReference.Name.AreEqual(nameof(CommandServiceComponent.Id)))
            {
                var component = (CommandServiceComponent)e.PropertyReference.GetSource();

                var registeredMetadata = _metadata[e.OldValue].FirstOrDefault(metadata => metadata.ComponentReference.Target.AreEqual(component));
                _metadata.Remove(e.OldValue, registeredMetadata);
                _metadata.Add(e.NewValue, registeredMetadata);
                _activations[e.NewValue].Raise(this, component);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles a property changed event raised by the action. All
        /// control properties are updated.
        /// </summary>
        /// <param name="sender">not used</param>
        /// <param name="e">not used</param>
        void UpdateControlProperties(object sender, PropertyChangedEventArgs e)
        {
            #region Preconditions

            Contract.RequireNotNullArgument(e, "e");

            #endregion

            if (logger.IsDebugEnabled)
            {
                logger.Debug(string.Format("Property '{0}' of action '{1}' changed from '{2}' to '{3}'.",
                                           e.PropertyName, action.Name, ChangedPropertyEventArgs.GetOldValue(e), ChangedPropertyEventArgs.GetNewValue(e)));
            }
            UpdateControlProperties();
        }