Exemplo n.º 1
0
        public IEnumerable GetResolvedSelectedDataSource()
        {
            IEnumerable enumerable = null;
            DataBinding binding    = base.DataBindings["DataSource"];

            if (binding != null)
            {
                enumerable = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression, this.DataMember);
            }
            return(enumerable);
        }
Exemplo n.º 2
0
        public object GetSelectedDataSource()
        {
            object      selectedDataSource = null;
            DataBinding binding            = base.DataBindings["DataSource"];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression);
            }
            return(selectedDataSource);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Used by the DataMemberConverter to resolve the DataSource which it can then use
        /// to populate a drop down box containing a list of available tables.
        /// </summary>
        /// <returns>The object that is our DataSource</returns>
        object IDataSourceProvider.GetSelectedDataSource()
        {
            DataBinding binding;

            binding = this.DataBindings["DataSource"];
            if (binding != null)
            {
                return(DesignTimeData.GetSelectedDataSource(this.Component, binding.Expression));
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Used by the DataFieldConverter to resolve the DataSource and DataMember combination
        /// so that it can populate a dropdown with a list of available fields.
        /// </summary>
        IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource()
        {
            DataBinding binding;

            binding = this.DataBindings["DataSource"];
            if (binding != null)
            {
                return(DesignTimeData.GetSelectedDataSource(this.Component, binding.Expression, this.DataMember));
            }
            return(null);
        }
        object IDataSourceProvider.GetSelectedDataSource()
        {
            object      selectedDataSource = null;
            DataBinding binding            = base.DataBindings["DataSource"];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource((DataBoundControl)base.Component, binding.Expression);
            }
            return(selectedDataSource);
        }
        IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource()
        {
            IEnumerable enumerable = null;
            DataBinding binding    = base.DataBindings["DataSource"];

            if (binding != null)
            {
                enumerable = DesignTimeData.GetSelectedDataSource((DataBoundControl)base.Component, binding.Expression, this.DataMember);
            }
            return(enumerable);
        }
Exemplo n.º 7
0
        IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource()
        {
            IEnumerable selectedDataSource = null;

            DataBinding binding = DataBindings["DataSource"];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(Component, binding.Expression, DataMember);
            }

            return(selectedDataSource);
        }
        /// <include file='doc\BaseDataListDesigner.uex' path='docs/doc[@for="BaseDataListDesigner.GetResolvedSelectedDataSource"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public IEnumerable GetResolvedSelectedDataSource()
        {
            IEnumerable selectedDataSource = null;

            DataBinding binding = DataBindings["DataSource"];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(bdl, binding.Expression, DataMember);
            }

            return(selectedDataSource);
        }
        /// <summary>
        ///    <para>
        ///       Gets the selected data source component from the component's container.
        ///    </para>
        /// </summary>
        /// <returns>
        ///    <para>
        ///       An IEnumerable with the
        ///       selected data source, or <see langword='null'/> if a data source is not found, or if a data
        ///       source with the same name does not exist.
        ///    </para>
        /// </returns>
        /// <seealso cref='System.Web.UI.Design.IDataSourceProvider'/>
        public Object GetSelectedDataSource()
        {
            Object selectedDataSource = null;

            DataBinding binding = DataBindings[_dataSourcePropertyName];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(_objectList, binding.Expression);
            }

            return(selectedDataSource);
        }
        public IEnumerable GetResolvedSelectedDataSource()
        {
            IEnumerable selectedDataSource = null;

            DataBinding binding = DataBindings[_dataSourcePropertyName];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(_objectList, binding.Expression, DataMember);
            }

            return(selectedDataSource);
        }
Exemplo n.º 11
0
        /// <include file='doc\RepeaterDesigner.uex' path='docs/doc[@for="RepeaterDesigner.GetSelectedDataSource"]/*' />
        /// <devdoc>
        ///   Retrieves the selected datasource component from the component's container.
        /// </devdoc>
        public object GetSelectedDataSource()
        {
            object selectedDataSource = null;

            DataBinding binding = DataBindings["DataSource"];

            if (binding != null)
            {
                selectedDataSource = DesignTimeData.GetSelectedDataSource(repeater, binding.Expression);
            }

            return(selectedDataSource);
        }
Exemplo n.º 12
0
        protected virtual IHierarchicalEnumerable GetDesignTimeDataSource()
        {
            bool flag;
            IHierarchicalEnumerable            designTimeData = null;
            DesignerHierarchicalDataSourceView designerView   = this.DesignerView;

            if (designerView != null)
            {
                try
                {
                    designTimeData = designerView.GetDesignTimeData(out flag);
                }
                catch (Exception exception)
                {
                    if (base.Component.Site != null)
                    {
                        IComponentDesignerDebugService service = (IComponentDesignerDebugService)base.Component.Site.GetService(typeof(IComponentDesignerDebugService));
                        if (service != null)
                        {
                            service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerHierarchicalDataSourceView.GetDesignTimeData", exception.Message }));
                        }
                    }
                }
            }
            else
            {
                DataBinding binding = base.DataBindings["DataSource"];
                if (binding != null)
                {
                    designTimeData = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression, null) as IHierarchicalEnumerable;
                }
            }
            if (designTimeData != null)
            {
                ICollection is2 = designTimeData as ICollection;
                if ((is2 == null) || (is2.Count > 0))
                {
                    return(designTimeData);
                }
            }
            flag = true;
            return(this.GetSampleDataSource());
        }
Exemplo n.º 13
0
        /// <include file='doc\DataFieldConverter.uex' path='docs/doc[@for="DataFieldConverter.GetStandardValues"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Gets the fields present within the selected data source if information about them is available.
        ///    </para>
        /// </devdoc>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            object[]   names                 = null;
            String     dataMember            = null;
            bool       autoGenerateFields    = false;
            bool       autoGenerateFieldsSet = false;
            ObjectList objectList            = null;

            if (context != null)
            {
                ArrayList list = new ArrayList();

                PropertyDescriptorCollection props = null;

                IComponent component = context.Instance as IComponent;
                if (component is IDeviceSpecificChoiceDesigner)
                {
                    Object             owner = ((ChoicePropertyFilter)component).Owner;
                    PropertyDescriptor pd    =
                        ((ICustomTypeDescriptor)component).GetProperties()[_dataMemberPropertyName];
                    Debug.Assert(pd != null, "Cannot get DataMember");

                    if (owner is ObjectList)
                    {
                        autoGenerateFields    = ((ObjectList)owner).AutoGenerateFields;
                        autoGenerateFieldsSet = true;
                    }

                    component = ((IDeviceSpecificChoiceDesigner)component).UnderlyingControl;

                    // See if owner already has a DataMember
                    dataMember = (String)pd.GetValue(owner);
                    Debug.Assert(dataMember != null);
                    if (dataMember == String.Empty)
                    {
                        // Get it from underlying object.
                        dataMember = (String)pd.GetValue(component);
                        Debug.Assert(dataMember != null);
                    }
                }

                if (component != null)
                {
                    objectList = component as ObjectList;

                    if (objectList != null)
                    {
                        foreach (ObjectListField field in objectList.Fields)
                        {
                            list.Add(field.Name);
                        }

                        if (!autoGenerateFieldsSet)
                        {
                            autoGenerateFields = objectList.AutoGenerateFields;
                        }
                    }

                    if (objectList == null || autoGenerateFields)
                    {
                        ISite componentSite = component.Site;
                        if (componentSite != null)
                        {
                            IDesignerHost designerHost = (IDesignerHost)componentSite.GetService(typeof(IDesignerHost));
                            if (designerHost != null)
                            {
                                IDesigner designer = designerHost.GetDesigner(component);

                                if (designer is IDataSourceProvider)
                                {
                                    IEnumerable dataSource = null;
                                    if (dataMember != null && dataMember != String.Empty)
                                    {
                                        DataBindingCollection dataBindings =
                                            ((HtmlControlDesigner)designer).DataBindings;
                                        DataBinding binding = dataBindings[_dataSourcePropertyName];
                                        if (binding != null)
                                        {
                                            dataSource =
                                                DesignTimeData.GetSelectedDataSource(
                                                    component,
                                                    binding.Expression,
                                                    dataMember);
                                        }
                                    }
                                    else
                                    {
                                        dataSource =
                                            ((IDataSourceProvider)designer).GetResolvedSelectedDataSource();
                                    }

                                    if (dataSource != null)
                                    {
                                        props = DesignTimeData.GetDataFields(dataSource);
                                    }
                                }
                            }
                        }
                    }
                }

                if (props != null)
                {
                    foreach (PropertyDescriptor propDesc in props)
                    {
                        list.Add(propDesc.Name);
                    }
                }

                names = list.ToArray();
                Array.Sort(names);
            }
            return(new StandardValuesCollection(names));
        }