CancelableProgressorSource in Pro only works for first geoprocessor?

727
1
09-24-2019 03:31 PM
StephenDavis1
New Contributor II

I have written an add-in for ArcGIS Pro 2.4.1 in C#. This add in calls a few different geoprocessors synchronously, like RegisterAsVersioned and CreateDatabaseUser. I am using CancelableProgressorSource to show some progress on the screen. Only the first Geoprocessor that is executed opens the dialog and shows the progress. Every Geoprocessor after the first one runs as though I did not supply the dialog. I have tried changing the order the Geoprocessors run in just to make sure it is not any particular one, and it does not seem to matter which one goes first. For example, if I run RegisterAsVersioned on a database first, and then run CreateDatabaseUser, then I get the dialog for RegisterAsVersioned, but the latter has no dialog open and I just have to sit there waiting for it to complete. If I reverse the order of those, it opens for CreateDatabaseUser and not RegisterAsVersioned.

I have tried calling Dispose() on the dialog and not calling Dispose(). I have tried calling Hide() and not calling Hide(). 

Is there a way to show the progress of multiple Geoprocessors running synchronously? Am I missing something on the implementation?

The following is currently my method for executing the GeoProcessor with the cancel window.

private static async Task<IGPResult> ExecuteGeoprocessor(string geoprocessorName,
IEnumerable<string> values,
IEnumerable<KeyValuePair<string, string>> environments = null,
GPToolExecuteEventHandler callback = null,
GPExecuteToolFlags flags = GPExecuteToolFlags.Default)
{
IGPResult retVal = null;

var progDlg = new ProgressDialog("Running Geoprocessor", "Cancel", 100, true);
progDlg.Show();

var progSrc = new CancelableProgressorSource(progDlg);
retVal = await Geoprocessing.ExecuteToolAsync(geoprocessorName, values, environments, progSrc.Progressor, flags);
progDlg.Hide();
return retVal;
}

0 Kudos
1 Reply
danielgis
New Contributor

Just change the last parameter from True to False on this line

var progDlg = new ProgressDialog("Running Geoprocessor", "Cancel", 100, False);
Tags (1)
0 Kudos