public void TearDown()
 {
     _table0?.Dispose();
     _table1?.Dispose();
     _geodatabase?.Dispose();
     //_repository?.Dispose();
 }
Beispiel #2
0
        protected override async void OnClick()
        {
            //queued task open database
            var result = await QueuedTask.Run(() =>
            {
                var filter = new QueryFilter
                {
                    SubFields              = "Shape",
                    PrefixClause           = "TOP 1",
                    WhereClause            = $"ObjectId = 15735",
                    OutputSpatialReference = MapView.Active.Map.SpatialReference
                };

                //make connection file reference
                var connectionFile = new DatabaseConnectionFile(
                    new Uri("c:\\test\\connection.sde"));

                var geodatabase =
                    new Geodatabase(connectionFile);

                var table = geodatabase.OpenDataset <Table>
                                ("Mapworks.SDE.Wire");

                //if the column I want isn't there, bail
                if (table.GetDefinition().FindField("Shape") < 0)
                {
                    return(null);
                }
                try
                {
                    using (var read = table.Search(filter, true))
                    {
                        if (read.MoveNext())
                        {
                            return(read.Current["Shape"]);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
                finally
                {
                    table.Dispose();
                    geodatabase.Dispose();
                }

                return(null);
            });
        }
Beispiel #3
0
 public void TearDown()
 {
     _geodatabase?.Dispose();
     _issuePoints?.Dispose();
 }