public void ProviderChanged()
        {
            FdoProviderInfo prov = _view.SelectedProvider;

            if (prov != null)
            {
                _view.ResetGrid();
                _pendingProperties.Clear();
                IList <DictionaryProperty> props = FdoFeatureService.GetConnectProperties(prov.Name);
                if (props != null)
                {
                    foreach (DictionaryProperty p in props)
                    {
                        if (p.Enumerable)
                        {
                            EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty;
                            if (!ep.RequiresConnection)
                            {
                                _view.AddEnumerableProperty(ep.Name, ep.DefaultValue, ep.Values);
                            }
                            else
                            {
                                _pendingProperties.Add(ep);
                            }
                        }
                        else
                        {
                            _view.AddProperty(p);
                        }
                    }
                }

                using (var conn = FeatureAccessManager.GetConnectionManager().CreateConnection(prov.Name))
                {
                    _view.ConfigEnabled = conn.ConnectionCapabilities.SupportsConfiguration();
                }
            }
        }
Exemple #2
0
        public OgrEsriPgbEditor()
        {
            box.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged);

            //Since ESRI PGB is basically a ODBC DSN, we get a free builder by just using
            //the DataSourceName property from the ODBC FDO Provider
            IList <DictionaryProperty>   props      = FdoFeatureService.GetConnectProperties("OSGeo.ODBC");
            EnumerableDictionaryProperty dataSource = null;

            foreach (DictionaryProperty dp in props)
            {
                if (dp.Enumerable && dp.Name == "DataSourceName")
                {
                    dataSource = (EnumerableDictionaryProperty)dp;
                }
            }

            if (dataSource != null)
            {
                box.SelectionMode = SelectionMode.One;
                box.DataSource    = dataSource.Values;
            }
        }
        public void ProviderChanged()
        {
            FdoProviderInfo prov = _view.SelectedProvider;

            if (prov != null)
            {
                _view.ResetDataStoreGrid();

                IList <DictionaryProperty> dprops = FdoFeatureService.GetCreateDataStoreProperties(prov.Name);
                if (dprops != null)
                {
                    foreach (DictionaryProperty p in dprops)
                    {
                        if (p.Enumerable)
                        {
                            EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty;
                            if (!ep.RequiresConnection)
                            {
                                _view.AddEnumerableDataStoreProperty(ep.Name, ep.DefaultValue, ep.Values);
                            }
                        }
                        else
                        {
                            _view.AddDataStoreProperty(p);
                        }
                    }
                    _view.CreateEnabled = true;
                }
                else
                {
                    _view.ShowError("Selected provider does not support creation of data stores");
                    _view.ResetDataStoreGrid();
                    _view.ResetConnectGrid();
                    _view.CreateEnabled = false;
                    return;
                }

                if (!prov.IsFlatFile)
                {
                    _view.ResetConnectGrid();
                    IList <DictionaryProperty> cprops = FdoFeatureService.GetConnectProperties(prov.Name);
                    if (cprops != null)
                    {
                        foreach (DictionaryProperty p in cprops)
                        {
                            if (p.Enumerable)
                            {
                                EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty;
                                if (!ep.RequiresConnection)
                                {
                                    _view.AddEnumerableConnectProperty(ep.Name, ep.DefaultValue, ep.Values);
                                }
                            }
                            else
                            {
                                _view.AddConnectProperty(p);
                            }
                        }
                    }
                }
            }
        }