private void AddProperty(LocationReference reference, Dictionary<string, object> names, List<PropertyDescriptorImpl> propertyList)
 {
     if (!string.IsNullOrEmpty(reference.Name) && !names.ContainsKey(reference.Name))
     {
         names.Add(reference.Name, reference);
         PropertyDescriptorImpl item = new PropertyDescriptorImpl(reference);
         propertyList.Add(item);
         this.AddNotifyHandler(item);
     }
 }
 private void AddProperty(LocationReference reference, Dictionary <string, object> names, List <PropertyDescriptorImpl> propertyList)
 {
     if (!string.IsNullOrEmpty(reference.Name) && !names.ContainsKey(reference.Name))
     {
         names.Add(reference.Name, reference);
         PropertyDescriptorImpl item = new PropertyDescriptorImpl(reference);
         propertyList.Add(item);
         this.AddNotifyHandler(item);
     }
 }
 private void AddNotifyHandler(PropertyDescriptorImpl property)
 {
     using (ActivityContext context = this.ResolutionContext)
     {
         Location key = property.LocationReference.GetLocation(context);
         INotifyPropertyChanged changed = key as INotifyPropertyChanged;
         if (changed != null)
         {
             changed.PropertyChanged += this.PropertyChangedEventHandler;
             if (this.locationMapping == null)
             {
                 this.locationMapping = new Dictionary<Location, PropertyDescriptorImpl>();
             }
             this.locationMapping.Add(key, property);
         }
     }
 }
 private void AddNotifyHandler(PropertyDescriptorImpl property)
 {
     using (ActivityContext context = this.ResolutionContext)
     {
         Location key = property.LocationReference.GetLocation(context);
         INotifyPropertyChanged changed = key as INotifyPropertyChanged;
         if (changed != null)
         {
             changed.PropertyChanged += this.PropertyChangedEventHandler;
             if (this.locationMapping == null)
             {
                 this.locationMapping = new Dictionary <Location, PropertyDescriptorImpl>();
             }
             this.locationMapping.Add(key, property);
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds the notify handler.
        /// </summary>
        /// <param name="property">The property.</param>
        private void AddNotifyHandler(PropertyDescriptorImpl property)
        {
            var activityContext = this.ResolutionContext;

            try
            {
                var location = property.LocationReference.GetLocation(activityContext);
                if (location is INotifyPropertyChanged notify)
                {
                    notify.PropertyChanged += this.PropertyChangedEventHandler;

                    if (this.locationMapping == null)
                    {
                        this.locationMapping = new Dictionary <Location, PropertyDescriptorImpl>();
                    }
                    this.locationMapping.Add(location, property);
                }
            }
            finally
            {
                activityContext.Dispose();
            }
        }
        void AddNotifyHandler(PropertyDescriptorImpl property)
        {
            ActivityContext activityContext = this.ResolutionContext;
            try
            {
                Location location = property.LocationReference.GetLocation(activityContext);
                INotifyPropertyChanged notify = location as INotifyPropertyChanged;
                if (notify != null)
                {
                    notify.PropertyChanged += PropertyChangedEventHandler;

                    if (this.locationMapping == null)
                    {
                        this.locationMapping = new Dictionary<Location, PropertyDescriptorImpl>();
                    }
                    this.locationMapping.Add(location, property);
                }
            }
            finally
            {
                activityContext.Dispose();
            }
        }