Exemplo n.º 1
0
        private void btnEditSchema_Click(object sender, EventArgs e)
        {
            if (CheckValidConnection())
            {
                if (string.IsNullOrEmpty(_defaultSchemaName))
                {
                    var names = _service.CurrentConnection.FeatureService.GetSchemas(_fs.ResourceID);
                    if (names.Length == 1)
                    {
                        _defaultSchemaName = names[0];
                    }
                    else
                    {
                        MessageBox.Show(Strings.NoSchemasInFeatureSource);
                        return;
                    }
                }

                string xml = _fs.GetConfigurationContent(_service.CurrentConnection);
                if (!string.IsNullOrEmpty(xml))
                {
                    _doc = (OdbcConfigurationDocument)ConfigurationDocument.LoadXml(xml);
                }
                else
                {
                    if (_doc == null)
                    {
                        BuildDefaultDocument();
                    }
                }

                var diag = new TableConfigurationDialog(_service, _doc, _defaultSchemaName);
                if (diag.ShowDialog() == DialogResult.OK)
                {
                    _doc.ClearMappings();
                    foreach (var table in diag.ConfiguredTables)
                    {
                        _doc.AddOverride(table);
                    }
                    foreach (var sc in _doc.SpatialContexts)
                    {
                        sc.CoordinateSystemWkt = diag.CoordinateSystemWkt;
                    }
                    string updatedContent = _doc.ToXml();
                    _fs.SetConfigurationContent(_service.CurrentConnection, updatedContent);
                    OnResourceChanged();
                }
            }
        }
Exemplo n.º 2
0
        private void DoUpdateConfiguration(string[] toAdd, string[] toRemove, bool isAlias)
        {
            if (_conf == null)
            {
                BuildDefaultDocument();
            }

            var pdlg = new ProgressDialog();

            pdlg.CancelAbortsThread = true;
            var worker = new ProgressDialog.DoBackgroundWork(UpdateConfigurationDocument);
            var result = (UpdateConfigResult)pdlg.RunOperationAsync(null, worker, _conf, _service.CurrentConnection, toAdd, toRemove, isAlias);

            if (result.Added.Count > 0 || result.Removed.Count > 0)
            {
                _fs.SetConfigurationContent(_service.CurrentConnection, _conf.ToXml());
                List <ListViewItem> remove = new List <ListViewItem>();
                foreach (ListViewItem lvi in lstView.Items)
                {
                    if (result.Removed.Contains(lvi.Text))
                    {
                        remove.Add(lvi);
                    }
                }
                foreach (var added in result.Added)
                {
                    string dir      = null;
                    string fileName = null;
                    if (isAlias)
                    {
                        dir      = added.Substring(0, added.LastIndexOf("\\"));  //NOXLATE
                        fileName = added.Substring(added.LastIndexOf("\\") + 1); //NOXLATE
                    }
                    else
                    {
                        dir      = Path.GetDirectoryName(added);
                        fileName = Path.GetFileName(added);
                    }

                    foreach (var loc in _conf.RasterLocations)
                    {
                        if (loc.Location == dir)
                        {
                            foreach (var item in loc.Items)
                            {
                                if (item.FileName == fileName)
                                {
                                    AddRasterItem(dir, item);
                                }
                            }
                        }
                    }
                }
                OnResourceChanged();
            }
        }
Exemplo n.º 3
0
        private void btnAdvanced_Click(object sender, EventArgs e)
        {
            WriteEncryptedCredentials();
            var diag = new WmsAdvancedConfigurationDialog(_service);

            if (diag.ShowDialog() == DialogResult.OK)
            {
                _fs.SetConfigurationContent(_service.CurrentConnection, diag.Document.ToXml());
                OnResourceChanged();
            }
        }
        private void btnEditConfiguration_Click(object sender, EventArgs e)
        {
            var content = _fs.GetConfigurationContent(_edsvc.CurrentConnection);
            var dlg     = new XmlEditorDialog(_edsvc);

            dlg.OnlyValidateWellFormedness = true;
            dlg.XmlContent = content;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                content = dlg.XmlContent;
                _fs.SetConfigurationContent(_edsvc.CurrentConnection, content);
                OnResourceChanged();
            }
        }
 private void btnSave_Click(object sender, EventArgs e)
 {
     _fs.SetConfigurationContent(_service.CurrentConnection, _config.ToXml());
     this.DialogResult = DialogResult.OK;
 }