Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
You may want to cast it to FeatureClass.
To ensure maximum robustness, callers should explicitly dispose of the returned ArcGIS.Core.Data.Table in either a using
statement or a finally
block.
public async Task ObtainingGeodatabaseFromFeatureLayer() { IEnumerable<Layer> layers = MapView.Active.Map.Layers.Where(layer => layer is FeatureLayer); await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { foreach (FeatureLayer featureLayer in layers) { using (Table table = featureLayer.GetTable()) using (Datastore datastore = table.GetDatastore()) { if (datastore is UnknownDatastore) continue; Geodatabase geodatabase = datastore as Geodatabase; } } }); }
//Note: call within QueuedTask.Run() var table = featureLayer.GetTable(); var count = table.GetCount();
await QueuedTask.Run(() => { using (var table = annoLayer.GetTable()) { using (var rc = table.Search()) { rc.MoveNext(); using (var af = rc.Current as AnnotationFeature) { var graphic = af.GetGraphic(); var textGraphic = graphic as CIMTextGraphic; //Note: //var outline_geom = af.GetGraphicOutline(); //gets the anno text outline geometry... } } } });
Target Platforms: Windows 11, Windows 10, Windows 8.1