I have a bit of code that executes two Geoprocessing tools. I create a ProgressDialog to show the progress, but I'm at a loss to determine why it sometimes shows and sometimes does not show. To be more precise, sometimes the dialog appears for a split second, then disappears. The Geoprocessing.ExecuteToolAsync still runs in the background, but my users will need that feedback from the ProgressDialog.
Code:
var mergeDlg = new ProgressDialog("Merging and Clipping Raster", "Cancel", 100, false);
var progsrc=new CancelableProgressorSource(mergeDlg);
await Geoprocessing.ExecuteToolAsync(
short_mergetool_name,
mergeParams,
env,
progSrc.Progressor,
GPExecuteToolFlags.None);
await Geoprocessing.ExecuteToolAsync(
short_cliptool_name,
clipParams,
null,
progSrc.Progressor,
GPExecuteToolFlags.Default);
I have tried bracketing the ExecuteToolAsync calls with mergeDlg.Show() and .Hide(), but it doesn't seem to make any difference. Sometimes it displays, sometimes it doesn't.
The only other possibly relevant info I can think of is that further up in the code, I'm creating a separate simple ProgressDialog that displays during archive extraction. That one always displays with .Show() / .Hide(). I'm not passing that one to any Geoprocessing tools.
Oh, and I'm not running this with the debugger. 😉