コード例 #1
0
        private void MarkSelected()
        {
            var file = _fs.GetConnectionProperty(this.FileFdoProperty);

            if (!string.IsNullOrEmpty(file))
            {
                if (_fs.UsesEmbeddedDataFiles)
                {
                    rdManaged.Checked = true;
                    var df = _fs.GetEmbeddedDataName();
                    resDataCtrl.MarkedFile = df;
                }
                else //if (_fs.UsesAliasedDataFiles)
                {
                    txtAlias.Text       = file;
                    rdUnmanaged.Checked = true;
                }
            }
        }
コード例 #2
0
        public override void Bind(IEditorService service)
        {
            _init    = true;
            _service = service;
            _fs      = (IFeatureSource)_service.GetEditedResource();

            resDataCtrl.Init(service);
            if (_fs.UsesEmbeddedDataFiles)
            {
                var df = _fs.GetEmbeddedDataName();
                resDataCtrl.MarkedFile = df;
            }

            var values = _fs.GetConnectionProperties();

            txtDataSource.Text  = values[P_DATASOURCE];
            chkReadOnly.Checked = values[P_READONLY] == "TRUE";                                   //NOXLATE

            var prov = _service.CurrentConnection.FeatureService.GetFeatureProvider("OSGeo.OGR"); //NOXLATE

            foreach (var p in prov.ConnectionProperties.Where(p => p.Name != P_DATASOURCE && p.Name != P_READONLY))
            {
                var row      = new DataGridViewRow();
                var nameCell = new DataGridViewTextBoxCell();
                nameCell.Value       = p.Name;
                nameCell.ToolTipText = p.LocalizedName;

                var currentValue           = _fs.GetConnectionProperty(p.Name);
                DataGridViewCell valueCell = null;
                if (p.Enumerable)
                {
                    valueCell       = new DataGridViewTextBoxCell();
                    valueCell.Tag   = p;
                    valueCell.Value = currentValue;
                }
                else
                {
                    valueCell       = new DataGridViewTextBoxCell();
                    valueCell.Tag   = p;
                    valueCell.Value = currentValue;
                }

                if (string.IsNullOrEmpty(currentValue) && !string.IsNullOrEmpty(p.DefaultValue))
                {
                    valueCell.Value = p.DefaultValue;
                    _fs.SetConnectionProperty(p.Name, p.DefaultValue);
                }

                row.Cells.Add(nameCell);
                row.Cells.Add(valueCell);

                if (p.Protected)
                {
                    pwdCells.Add(valueCell);
                }

                grdOtherProperties.Rows.Add(row);
            }

            _init = false;
        }