Hi,
I am struggling to understand the behavior of the ProgressDialog. I have some business logic to perform when user clicks a custom button in a ribbon. Part of the logic is synchronous and part is asynchronous GP Service call that user is not interested in waiting for. It seems no matter what I do, ProgressDialog remains displayed during an asynchronous call.
I looked at the example at https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Framework/ProgressDialog/RunDialogButtons.cs
and modified RunDialogButtonsCancel classes' OnClick method slightly as below
internal class RunDialogButtonsCancel : Button
{
protected override async void OnClick()
{ //If you run this in the DEBUGGER you will NOT see the dialog
uint maxSteps = 10;
using (var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog(
"Doing my thing - cancelable", "Canceled", maxSteps, false))
{
CancelableProgressorSource cps = new CancelableProgressorSource(pd);
// Run a user cancellable process
pd.Show();
await
ProgressDialogModule.RunCancelableProgress(
cps, maxSteps);
cps.Progressor.Value = maxSteps + 1;
pd.Hide();
}
// now wait for 10 seconds to prove ProgressDialog still remains in a display making pd.Hide() above useless
Task.Delay(10000).Wait();
}
}
And I can see that even after Hide method, the ProgressDialog remains displayed in the UI. Is there a trick to make it go away? Is it works as designed and that ProgressDialog remains displayed until the method in which it is created (OnClick event here) remains in-scope?
Thanks,