private ChildPropertyChangedProcessor(
     PropertyFieldBindingsMap propertyToFieldBindings, FieldValueComparer fieldValueComparer, ExplicitDependencyMap explicitDependencyMap )
 {
     this.fieldValueComparer = fieldValueComparer;
     this.explicitDependencyMap = explicitDependencyMap;
     this.propertyToFieldBindings = propertyToFieldBindings;
 }
 private ChildPropertyChangedProcessor(
     PropertyFieldBindingsMap propertyToFieldBindings, FieldValueComparer fieldValueComparer, ExplicitDependencyMap explicitDependencyMap)
 {
     this.fieldValueComparer      = fieldValueComparer;
     this.explicitDependencyMap   = explicitDependencyMap;
     this.propertyToFieldBindings = propertyToFieldBindings;
 }
 private PropertyFieldBindingsMap( PropertyFieldBindingsMap prototype )
 {
     this.propertyToFieldMapping = prototype.propertyToFieldMapping.ToDictionary(
         kv => kv.Key, kv => kv.Value.Select( b => new PropertyFieldBinding( b ) ).ToList() );
     this.fieldValueComparer = prototype.fieldValueComparer;
     this.fieldToPropertyMapping = prototype.fieldToPropertyMapping;
     this.filedInfos = prototype.FiledInfos;
 }
Ejemplo n.º 4
0
 private PropertyFieldBindingsMap(PropertyFieldBindingsMap prototype)
 {
     this.propertyToFieldMapping = prototype.propertyToFieldMapping.ToDictionary(
         kv => kv.Key, kv => kv.Value.Select(b => new PropertyFieldBinding(b)).ToList());
     this.fieldValueComparer     = prototype.fieldValueComparer;
     this.fieldToPropertyMapping = prototype.fieldToPropertyMapping;
     this.filedInfos             = prototype.FiledInfos;
 }
 private ChildPropertyChangedProcessor(ChildPropertyChangedProcessor prototype, object instance)
 {
     this.instance                           = instance;
     this.fieldValueComparer                 = prototype.fieldValueComparer;
     this.explicitDependencyMap              = prototype.explicitDependencyMap;
     this.propertyToFieldBindings            = PropertyFieldBindingsMap.CreateFromPrototype(prototype.propertyToFieldBindings);
     this.notifyChildPropertyChangedHandlers = new Dictionary <string, NotifyChildPropertyChangedEventHandlerDescriptor>();
 }
 private ChildPropertyChangedProcessor( ChildPropertyChangedProcessor prototype, object instance )
 {
     this.instance = instance;
     this.fieldValueComparer = prototype.fieldValueComparer;
     this.explicitDependencyMap = prototype.explicitDependencyMap;
     this.propertyToFieldBindings = PropertyFieldBindingsMap.CreateFromPrototype( prototype.propertyToFieldBindings );
     this.notifyChildPropertyChangedHandlers = new Dictionary<string, NotifyChildPropertyChangedEventHandlerDescriptor>();
 }
        public static ChildPropertyChangedProcessor CompileTimeCreate(
            Type type,
            Dictionary <MethodBase, IList <FieldInfo> > methodFieldDependencies,
            FieldValueComparer fieldValueComparer,
            ExplicitDependencyMap explicitDependencyMap)
        {
            PropertyFieldBindingsMap propertyToFieldBindings = PropertyToFieldBindingGenerator.GenerateBindings(
                type, methodFieldDependencies, fieldValueComparer);

            return(new ChildPropertyChangedProcessor(propertyToFieldBindings, fieldValueComparer, explicitDependencyMap));
        }
            public static PropertyFieldBindingsMap GenerateBindings(
                Type type, Dictionary <MethodBase, IList <FieldInfo> > methodFieldDependencies, FieldValueComparer fieldValueComparer)
            {
                // build propertyToFieldBindings
                PropertyFieldBindingsMap propertyToFieldBindings = new PropertyFieldBindingsMap(type, fieldValueComparer);

                PropertyInfo[] allProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

                foreach (PropertyInfo propertyInfo in allProperties)
                {
                    IList <FieldInfo> fieldList;
                    if (methodFieldDependencies.TryGetValue(propertyInfo.GetGetMethod(), out fieldList))
                    {
                        List <FieldInfo> matchingFields = fieldList.Where(f => propertyInfo.PropertyType.IsAssignableFrom(f.FieldType)).ToList();
                        propertyToFieldBindings.AddBindings(propertyInfo, matchingFields, type);
                    }
                }
                return(propertyToFieldBindings);
            }
 public static PropertyFieldBindingsMap CreateFromPrototype( PropertyFieldBindingsMap prototype )
 {
     return new PropertyFieldBindingsMap( prototype );
 }
Ejemplo n.º 10
0
 public static PropertyFieldBindingsMap CreateFromPrototype(PropertyFieldBindingsMap prototype)
 {
     return(new PropertyFieldBindingsMap(prototype));
 }
            public static PropertyFieldBindingsMap GenerateBindings(
                Type type, Dictionary<MethodBase, IList<FieldInfo>> methodFieldDependencies, FieldValueComparer fieldValueComparer )
            {
                // build propertyToFieldBindings
                PropertyFieldBindingsMap propertyToFieldBindings = new PropertyFieldBindingsMap( type, fieldValueComparer );

                PropertyInfo[] allProperties = type.GetProperties( BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly );

                foreach ( PropertyInfo propertyInfo in allProperties )
                {
                    IList<FieldInfo> fieldList;
                    if ( methodFieldDependencies.TryGetValue( propertyInfo.GetGetMethod(), out fieldList ) )
                    {
                        List<FieldInfo> matchingFields = fieldList.Where( f => propertyInfo.PropertyType.IsAssignableFrom( f.FieldType ) ).ToList();
                        propertyToFieldBindings.AddBindings( propertyInfo, matchingFields, type );
                    }
                }
                return propertyToFieldBindings;
            }