internal PropertyInfo[] GetProperties(IServiceProvider serviceProvider) { ArrayList properties = new ArrayList(GetType().GetProperties()); if (this.property != null) { properties.Add(new PropertySegmentPropertyInfo(this, this.property)); } else if (this.propertyDescriptor != null) { properties.Add(new PropertySegmentPropertyInfo(this, this.propertyDescriptor)); } else if (this.obj != null) { PropertyDescriptorCollection props = null; TypeConverter converter = TypeDescriptor.GetConverter(this.obj); if (converter != null && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(this.serviceProvider, GetComponent(this.obj, serviceProvider), null); props = converter.GetProperties(dummyContext, this.obj, new Attribute[] { }); } else { props = TypeDescriptor.GetProperties(this.obj); } foreach (PropertyDescriptor propDesc in props) { PropertyInfo propInfo = XomlComponentSerializationService.GetProperty(this.obj.GetType(), propDesc.Name, BindingFlags.Public | BindingFlags.Instance); if (propInfo != null) { if (Helpers.GetSerializationVisibility(propInfo) == DesignerSerializationVisibility.Hidden) { continue; } properties.Add(new PropertySegmentPropertyInfo(this, propInfo)); } else { properties.Add(new PropertySegmentPropertyInfo(this, propDesc)); if (propDesc.Converter != null) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(this.serviceProvider, GetComponent(this.obj, serviceProvider), propDesc); if (propDesc.Converter.GetPropertiesSupported(dummyContext)) { foreach (PropertyDescriptor childDesc in propDesc.Converter.GetProperties(dummyContext, this.obj, new Attribute[] { })) { properties.Add(new PropertySegmentPropertyInfo(this, childDesc)); } } } } } } return(properties.ToArray(typeof(PropertyInfo)) as PropertyInfo[]); }
internal PropertyInfo[] GetProperties(IServiceProvider serviceProvider) { ArrayList list = new ArrayList(base.GetType().GetProperties()); if (this.property != null) { list.Add(new PropertySegmentPropertyInfo(this, this.property)); } else if (this.propertyDescriptor != null) { list.Add(new PropertySegmentPropertyInfo(this, this.propertyDescriptor)); } else if (this.obj != null) { PropertyDescriptorCollection properties = null; TypeConverter converter = TypeDescriptor.GetConverter(this.obj); if ((converter != null) && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext context = new DummyTypeDescriptorContext(this.serviceProvider, this.GetComponent(this.obj, serviceProvider), null); properties = converter.GetProperties(context, this.obj, new Attribute[0]); } else { properties = TypeDescriptor.GetProperties(this.obj); } foreach (System.ComponentModel.PropertyDescriptor descriptor in properties) { PropertyInfo memberInfo = XomlComponentSerializationService.GetProperty(this.obj.GetType(), descriptor.Name, BindingFlags.Public | BindingFlags.Instance); if (memberInfo != null) { if (Helpers.GetSerializationVisibility(memberInfo) != DesignerSerializationVisibility.Hidden) { list.Add(new PropertySegmentPropertyInfo(this, memberInfo)); } } else { list.Add(new PropertySegmentPropertyInfo(this, descriptor)); if (descriptor.Converter != null) { DummyTypeDescriptorContext context2 = new DummyTypeDescriptorContext(this.serviceProvider, this.GetComponent(this.obj, serviceProvider), descriptor); if (descriptor.Converter.GetPropertiesSupported(context2)) { foreach (System.ComponentModel.PropertyDescriptor descriptor2 in descriptor.Converter.GetProperties(context2, this.obj, new Attribute[0])) { list.Add(new PropertySegmentPropertyInfo(this, descriptor2)); } } } } } } return(list.ToArray(typeof(PropertyInfo)) as PropertyInfo[]); }
internal PropertyInfo[] GetProperties(IServiceProvider serviceProvider) { ArrayList list = new ArrayList(base.GetType().GetProperties()); if (this.property != null) { list.Add(new PropertySegmentPropertyInfo(this, this.property)); } else if (this.propertyDescriptor != null) { list.Add(new PropertySegmentPropertyInfo(this, this.propertyDescriptor)); } else if (this.obj != null) { PropertyDescriptorCollection properties = null; TypeConverter converter = TypeDescriptor.GetConverter(this.obj); if ((converter != null) && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext context = new DummyTypeDescriptorContext(this.serviceProvider, this.GetComponent(this.obj, serviceProvider), null); properties = converter.GetProperties(context, this.obj, new Attribute[0]); } else { properties = TypeDescriptor.GetProperties(this.obj); } foreach (System.ComponentModel.PropertyDescriptor descriptor in properties) { PropertyInfo memberInfo = XomlComponentSerializationService.GetProperty(this.obj.GetType(), descriptor.Name, BindingFlags.Public | BindingFlags.Instance); if (memberInfo != null) { if (Helpers.GetSerializationVisibility(memberInfo) != DesignerSerializationVisibility.Hidden) { list.Add(new PropertySegmentPropertyInfo(this, memberInfo)); } } else { list.Add(new PropertySegmentPropertyInfo(this, descriptor)); if (descriptor.Converter != null) { DummyTypeDescriptorContext context2 = new DummyTypeDescriptorContext(this.serviceProvider, this.GetComponent(this.obj, serviceProvider), descriptor); if (descriptor.Converter.GetPropertiesSupported(context2)) { foreach (System.ComponentModel.PropertyDescriptor descriptor2 in descriptor.Converter.GetProperties(context2, this.obj, new Attribute[0])) { list.Add(new PropertySegmentPropertyInfo(this, descriptor2)); } } } } } } return (list.ToArray(typeof(PropertyInfo)) as PropertyInfo[]); }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (obj == null) throw new ArgumentNullException("obj"); string propertyName = Name; DependencyProperty dependencyProperty = null; PropertySegment propertySegment = obj as PropertySegment; Activity activity = (propertySegment != null) ? propertySegment.Object as Activity : obj as Activity; if (activity != null) { Type propertyType = DeclaringType; if (!String.IsNullOrEmpty(propertyName) && propertyType != null) dependencyProperty = DependencyProperty.FromName(propertyName, propertyType); } PropertyDescriptor propertyDescriptor = null; object destnObject = null; if (propertySegment != null) { PropertyDescriptorCollection props = null; TypeConverter converter = TypeDescriptor.GetConverter(propertySegment.Object); if (converter != null && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(propertySegment.ServiceProvider, propertySegment.Object, this.realPropDesc); props = converter.GetProperties(dummyContext, propertySegment.Object, new Attribute[] { }); } else props = TypeDescriptor.GetProperties(propertySegment.Object); foreach (PropertyDescriptor propDesc in props) { if (propDesc.Name == propertyName) { propertyDescriptor = propDesc; } else if (propDesc.Converter != null) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(propertySegment.ServiceProvider, propertySegment.Object, propDesc); if (propDesc.GetValue(propertySegment.Object) != null && propDesc.Converter.GetPropertiesSupported(dummyContext)) { foreach (PropertyDescriptor childDesc in propDesc.Converter.GetProperties(dummyContext, propDesc.GetValue(propertySegment.Object), new Attribute[] { })) { if (childDesc.Name == propertyName) propertyDescriptor = childDesc; } } } } destnObject = propertySegment.Object; } else { propertyDescriptor = TypeDescriptor.GetProperties(obj)[propertyName]; destnObject = obj; } if (propertyDescriptor != null && destnObject != null) propertyDescriptor.SetValue(destnObject, value); }
internal PropertyInfo[] GetProperties(IServiceProvider serviceProvider) { ArrayList properties = new ArrayList(GetType().GetProperties()); if (this.property != null) { properties.Add(new PropertySegmentPropertyInfo(this, this.property)); } else if (this.propertyDescriptor != null) { properties.Add(new PropertySegmentPropertyInfo(this, this.propertyDescriptor)); } else if (this.obj != null) { PropertyDescriptorCollection props = null; TypeConverter converter = TypeDescriptor.GetConverter(this.obj); if (converter != null && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(this.serviceProvider, GetComponent(this.obj, serviceProvider), null); props = converter.GetProperties(dummyContext, this.obj, new Attribute[] { }); } else props = TypeDescriptor.GetProperties(this.obj); foreach (PropertyDescriptor propDesc in props) { PropertyInfo propInfo = XomlComponentSerializationService.GetProperty(this.obj.GetType(), propDesc.Name, BindingFlags.Public | BindingFlags.Instance); if (propInfo != null) { if (Helpers.GetSerializationVisibility(propInfo) == DesignerSerializationVisibility.Hidden) continue; properties.Add(new PropertySegmentPropertyInfo(this, propInfo)); } else { properties.Add(new PropertySegmentPropertyInfo(this, propDesc)); if (propDesc.Converter != null) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(this.serviceProvider, GetComponent(this.obj, serviceProvider), propDesc); if (propDesc.Converter.GetPropertiesSupported(dummyContext)) { foreach (PropertyDescriptor childDesc in propDesc.Converter.GetProperties(dummyContext, this.obj, new Attribute[] { })) { properties.Add(new PropertySegmentPropertyInfo(this, childDesc)); } } } } } } return properties.ToArray(typeof(PropertyInfo)) as PropertyInfo[]; }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (obj == null) { throw new ArgumentNullException("obj"); } string propertyName = Name; DependencyProperty dependencyProperty = null; PropertySegment propertySegment = obj as PropertySegment; Activity activity = (propertySegment != null) ? propertySegment.Object as Activity : obj as Activity; if (activity != null) { Type propertyType = DeclaringType; if (!String.IsNullOrEmpty(propertyName) && propertyType != null) { dependencyProperty = DependencyProperty.FromName(propertyName, propertyType); } } PropertyDescriptor propertyDescriptor = null; object destnObject = null; if (propertySegment != null) { PropertyDescriptorCollection props = null; TypeConverter converter = TypeDescriptor.GetConverter(propertySegment.Object); if (converter != null && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(propertySegment.ServiceProvider, propertySegment.Object, this.realPropDesc); props = converter.GetProperties(dummyContext, propertySegment.Object, new Attribute[] { }); } else { props = TypeDescriptor.GetProperties(propertySegment.Object); } foreach (PropertyDescriptor propDesc in props) { if (propDesc.Name == propertyName) { propertyDescriptor = propDesc; } else if (propDesc.Converter != null) { DummyTypeDescriptorContext dummyContext = new DummyTypeDescriptorContext(propertySegment.ServiceProvider, propertySegment.Object, propDesc); if (propDesc.GetValue(propertySegment.Object) != null && propDesc.Converter.GetPropertiesSupported(dummyContext)) { foreach (PropertyDescriptor childDesc in propDesc.Converter.GetProperties(dummyContext, propDesc.GetValue(propertySegment.Object), new Attribute[] { })) { if (childDesc.Name == propertyName) { propertyDescriptor = childDesc; } } } } } destnObject = propertySegment.Object; } else { propertyDescriptor = TypeDescriptor.GetProperties(obj)[propertyName]; destnObject = obj; } if (propertyDescriptor != null && destnObject != null) { propertyDescriptor.SetValue(destnObject, value); } }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (obj == null) { throw new ArgumentNullException("obj"); } string name = this.Name; System.Workflow.ComponentModel.Design.PropertySegment segment = obj as System.Workflow.ComponentModel.Design.PropertySegment; if (((segment != null) ? (segment.Object as Activity) : (obj as Activity)) != null) { Type declaringType = this.DeclaringType; if (!string.IsNullOrEmpty(name) && (declaringType != null)) { DependencyProperty.FromName(name, declaringType); } } PropertyDescriptor descriptor = null; object component = null; if (segment != null) { PropertyDescriptorCollection properties = null; TypeConverter converter = TypeDescriptor.GetConverter(segment.Object); if ((converter != null) && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext context = new DummyTypeDescriptorContext(segment.ServiceProvider, segment.Object, this.realPropDesc); properties = converter.GetProperties(context, segment.Object, new Attribute[0]); } else { properties = TypeDescriptor.GetProperties(segment.Object); } foreach (PropertyDescriptor descriptor2 in properties) { if (descriptor2.Name == name) { descriptor = descriptor2; } else if (descriptor2.Converter != null) { DummyTypeDescriptorContext context2 = new DummyTypeDescriptorContext(segment.ServiceProvider, segment.Object, descriptor2); if ((descriptor2.GetValue(segment.Object) != null) && descriptor2.Converter.GetPropertiesSupported(context2)) { foreach (PropertyDescriptor descriptor3 in descriptor2.Converter.GetProperties(context2, descriptor2.GetValue(segment.Object), new Attribute[0])) { if (descriptor3.Name == name) { descriptor = descriptor3; } } } } } component = segment.Object; } else { descriptor = TypeDescriptor.GetProperties(obj)[name]; component = obj; } if ((descriptor != null) && (component != null)) { descriptor.SetValue(component, value); } }
public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) { if (obj == null) { throw new ArgumentNullException("obj"); } string name = this.Name; System.Workflow.ComponentModel.Design.PropertySegment segment = obj as System.Workflow.ComponentModel.Design.PropertySegment; if (((segment != null) ? (segment.Object as Activity) : (obj as Activity)) != null) { Type declaringType = this.DeclaringType; if (!string.IsNullOrEmpty(name) && (declaringType != null)) { DependencyProperty.FromName(name, declaringType); } } PropertyDescriptor descriptor = null; object component = null; if (segment != null) { PropertyDescriptorCollection properties = null; TypeConverter converter = TypeDescriptor.GetConverter(segment.Object); if ((converter != null) && converter.GetPropertiesSupported()) { DummyTypeDescriptorContext context = new DummyTypeDescriptorContext(segment.ServiceProvider, segment.Object, this.realPropDesc); properties = converter.GetProperties(context, segment.Object, new Attribute[0]); } else { properties = TypeDescriptor.GetProperties(segment.Object); } foreach (PropertyDescriptor descriptor2 in properties) { if (descriptor2.Name == name) { descriptor = descriptor2; } else if (descriptor2.Converter != null) { DummyTypeDescriptorContext context2 = new DummyTypeDescriptorContext(segment.ServiceProvider, segment.Object, descriptor2); if ((descriptor2.GetValue(segment.Object) != null) && descriptor2.Converter.GetPropertiesSupported(context2)) { foreach (PropertyDescriptor descriptor3 in descriptor2.Converter.GetProperties(context2, descriptor2.GetValue(segment.Object), new Attribute[0])) { if (descriptor3.Name == name) { descriptor = descriptor3; } } } } } component = segment.Object; } else { descriptor = TypeDescriptor.GetProperties(obj)[name]; component = obj; } if ((descriptor != null) && (component != null)) { descriptor.SetValue(component, value); } }