HI,
When I call Map.RemoveLayers() on a list of annotation layers, ArcGIS Pro hangs up. Any idea why?
Thanks,
Martin
I implemented a configuration which allows you to make your modifications to the file geodatabase before the project is even loaded. I think this should alleviate the hanging issues and UI lockups you are seeing.
There are a few changes to the command line since you start ArcGIS Pro with the installed 'managed configuration' (which is like an add-in plus control over Pro startup & customization). The command line looks like this now:
C:\ArcGIS\bin\ArcGISPro.exe /config:"UpdateAnnotation" /load:"C:\Data\FeatureTest\FeatureTest.aprx"
where: UpdateAnnotation is the name of the 'managed configuration'
and C:\Data\FeatureTest\FeatureTest.aprx is the path to the project to open
You start Pro with the above command line, the default startup screen has been replaced by a custom startup screen which is showing the progress of your workflow (see the StartupUI folder) :
Your business logic (making new annotation - using MyBusinessLogic as a sample for each step) would go here in the OnApplicationReady override:
protected override async void OnApplicationReady ()
{
var projectPath = ParseCommandArgs("/load:");
if (string.IsNullOrEmpty(projectPath))
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(@"Command line parameter is required: /load:""path to project file""");
FrameworkApplication.Close();
return;
}
RunOnUiThread(() => _startupPageViewModel.TheProject = projectPath);
for (int i = 0; i < 10; i++)
{
RunOnUiThread(() => _startupPageViewModel.TheStatus += $"Step {i} \n");
await MyBusinessLogicAsync();
}
_ = Project.OpenAsync(projectPath);
}
I attached the complete project, i built it in 2.6 but 2.5 should work as well.
Thanks alot for the project and the guidance. I will try this out and let you know. I still need to open the Pro Project as I need access to the Map's Table of Contents but I'll read up on configurations - I haven't done much with them yet.
Thanks,
Martin
Do you need to delete and recreate the table, or just clear it out?
If deleting all the records is acceptable, you could try Table.DeleteRows(). If you pass in a default QueryFilter, this deletes all the rows in the table. Alternatively, you could use the Truncate geoprocessing tool.
--Rich
Hi Rich,
Thanks. Unfortunately, I need to delete and recreate the table.
Martin