private void ExtractFields(IDataSourceProvider dataSourceProvider, ArrayList fields) { IEnumerable resolvedSelectedDataSource = dataSourceProvider.GetResolvedSelectedDataSource(); if (resolvedSelectedDataSource != null) { PropertyDescriptorCollection dataFields = DesignTimeData.GetDataFields(resolvedSelectedDataSource); if ((dataFields != null) && (dataFields.Count != 0)) { foreach (PropertyDescriptor descriptor in dataFields) { fields.Add(new FieldItem(descriptor.Name, descriptor.PropertyType)); } } } }
public StringCollection GetStandardValues(Component component) { StringCollection fields = new StringCollection(); if (component != null) { ISite site1 = component.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component); DesignerDataSourceView view1 = ((DataBoundControlDesigner)designer1).DesignerView; if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { for (int num1 = 0; num1 < schemaArray1.Length; num1++) { fields.Add(schemaArray1[num1].Name); } } } } if (((fields.Count == 0) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { foreach (PropertyDescriptor descriptor1 in collection1) { fields.Add(descriptor1.Name); } } } } } } } return(fields); }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] objArray1 = null; if (context != null) { IComponent component1 = context.Instance as IComponent; if (component1 != null) { ISite site1 = component1.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component1); DesignerDataSourceView view1 = this.GetView(designer1); if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { objArray1 = new object[schemaArray1.Length]; for (int num1 = 0; num1 < schemaArray1.Length; num1++) { objArray1[num1] = schemaArray1[num1].Name; } } } } if (((objArray1 == null) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { ArrayList list1 = new ArrayList(); foreach (PropertyDescriptor descriptor1 in collection1) { list1.Add(descriptor1.Name); } objArray1 = list1.ToArray(); } } } } } } } return(new TypeConverter.StandardValuesCollection(objArray1)); }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] values = null; if (context != null) { IComponent instance = context.Instance as IComponent; if (instance != null) { ISite site = instance.Site; if (site != null) { IDesignerHost host = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (host != null) { IDesigner dataBoundControlDesigner = host.GetDesigner(instance); DesignerDataSourceView view = this.GetView(dataBoundControlDesigner); if (view != null) { IDataSourceViewSchema schema = null; try { schema = view.Schema; } catch (Exception exception) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.Schema", exception.Message })); } } if (schema != null) { IDataSourceFieldSchema[] fields = schema.GetFields(); if (fields != null) { values = new object[fields.Length]; for (int i = 0; i < fields.Length; i++) { values[i] = fields[i].Name; } } } } if (((values == null) && (dataBoundControlDesigner != null)) && (dataBoundControlDesigner is IDataSourceProvider)) { IDataSourceProvider provider = dataBoundControlDesigner as IDataSourceProvider; IEnumerable dataSource = null; if (provider != null) { dataSource = provider.GetResolvedSelectedDataSource(); } if (dataSource != null) { PropertyDescriptorCollection dataFields = DesignTimeData.GetDataFields(dataSource); if (dataFields != null) { ArrayList list = new ArrayList(); foreach (PropertyDescriptor descriptor in dataFields) { list.Add(descriptor.Name); } values = list.ToArray(); } } } } } } } return(new TypeConverter.StandardValuesCollection(values)); }