void ConnectionProperties_Click(object sender, EventArgs e) { if (_etconn == null) { return; } FormEventTableConnection dlg = new FormEventTableConnection(); dlg.DbConnectionString = _etconn.DbConnectionString; dlg.TableName = _etconn.TableName; dlg.IdField = _etconn.IdFieldName; dlg.XField = _etconn.XFieldName; dlg.YField = _etconn.YFieldName; dlg.SpatialReference = _etconn.SpatialReference; if (dlg.ShowDialog() == DialogResult.OK) { EventTableConnection etcon = new EventTableConnection( dlg.DbConnectionString, dlg.TableName, dlg.IdField, dlg.XField, dlg.YField, dlg.SpatialReference); ConfigConnections connStream = new ConfigConnections("eventtable", "546B0513-D71D-4490-9E27-94CD5D72C64A"); connStream.Add(dlg.TableName, etcon.ToXmlString()); _etconn = etcon; } }
public string ShowConnectionStringDialog(string initConnectionString) { EventTableConnection conn = new EventTableConnection(); try { conn.FromXmlString(initConnectionString); } catch { } this.DbConnectionString = conn.DbConnectionString; this.TableName = conn.TableName; this.IdField = conn.IdFieldName; this.XField = conn.XFieldName; this.YField = conn.YFieldName; this.SpatialReference = conn.SpatialReference; if (this.ShowDialog() == DialogResult.OK) { conn = new EventTableConnection( this.DbConnectionString, this.TableName, this.IdField, this.XField, this.YField, this.SpatialReference); return(conn.ToXmlString()); } return(String.Empty); }
public EventTableObject(IExplorerObject parent, string name, EventTableConnection etconn) : base(parent, typeof(IFeatureClass), 1) { _name = name; _etconn = etconn; List <ToolStripMenuItem> items = new List <ToolStripMenuItem>(); ToolStripMenuItem item = new ToolStripMenuItem(LocalizedResources.GetResString("Menu.ConnectionProperties", "Connection Properties...")); item.Click += new EventHandler(ConnectionProperties_Click); items.Add(item); _contextItems = items.ToArray(); }
public override void Refresh() { base.Refresh(); base.AddChildObject(new EventTableNewConnectionObject(this)); ConfigConnections conStream = new ConfigConnections("eventtable", "546B0513-D71D-4490-9E27-94CD5D72C64A"); Dictionary <string, string> DbConnectionStrings = conStream.Connections; foreach (string DbConnName in DbConnectionStrings.Keys) { EventTableConnection dbConn = new EventTableConnection(); dbConn.FromXmlString(DbConnectionStrings[DbConnName]); base.AddChildObject(new EventTableObject(this, DbConnName, dbConn)); } }
public void ExplorerObjectDoubleClick(ExplorerObjectEventArgs e) { FormEventTableConnection dlg = new FormEventTableConnection(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ConfigConnections connStream = new ConfigConnections("eventtable", "546B0513-D71D-4490-9E27-94CD5D72C64A"); EventTableConnection etconn = new EventTableConnection( dlg.DbConnectionString, dlg.TableName, dlg.IdField, dlg.XField, dlg.YField, dlg.SpatialReference); string id = connStream.GetName(dlg.TableName); connStream.Add(id, etconn.ToXmlString()); e.NewExplorerObject = new EventTableObject(this.ParentExplorerObject, id, etconn); } }