コード例 #1
0
ファイル: ExplorerObjects.cs プロジェクト: jugstalt/gview5
        async public Task <object> GetInstanceAsync()
        {
            if (_fc != null)
            {
                return(_fc);
            }

            if (_etconn != null)
            {
                try
                {
                    Dataset ds = new Dataset();
                    await ds.SetConnectionString(_etconn.ToXmlString());

                    await ds.Open();

                    _fc = (await ds.Elements())[0].Class as IFeatureClass;
                    return(_fc);
                }
                catch
                {
                    _fc = null;
                }
            }

            return(null);
        }
コード例 #2
0
ファイル: ExplorerObjects.cs プロジェクト: jugstalt/gview5
        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;
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: ExplorerObjects.cs プロジェクト: jugstalt/gview5
        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);
            }
        }