I have created a ProgressDialog but not able to see even without debugging mode on button click event.
protected override async void OnClick()
{
using (var progress = new ProgressDialog("Showing Progress", "Canceled", 100, false))
{
var status = new CancelableProgressorSource(progress);
status.Max = 100;
progress.Show();
await QueuedTask.Run(async () =>
{
uint step = 0;
for (var idx = 0; idx < 10; idx++)
{
await Task.Delay(1000);
status.Progressor.Value += 10;
status.Progressor.Status = (status.Progressor.Value * 100 / status.Progressor.Max) + @" % Completed";
status.Progressor.Message = "Message " + status.Progressor.Value;
}
}, status.Progressor);
progress.Hide();
}
}
Any ideas here??
Solved! Go to Solution.
If you are running add-ins from Visual studio it will not show progress dialog ( no matter Debug or Release mode) . Try to run it directly from ArcGISPro.exe executable.
Hi,
I think that you update progress not from UI thread. This link could help you:
https://community.esri.com/t5/arcgis-pro-sdk-questions/best-way-to-show-progress/m-p/778671
@GKmieliauskas I don't have any separate Xaml to add the WPF Progress Bar. I just have a button in the tab. On that button click I am calling an api for which I have to use the progress till the time we will get the response. The example shows the Wpf progress bar not the pro one.
If you are running add-ins from Visual studio it will not show progress dialog ( no matter Debug or Release mode) . Try to run it directly from ArcGISPro.exe executable.
There are some examples that show WPF progressors on Dockpanes in the 2022 Palm Springs tech session (https://esri.github.io/arcgis-pro-sdk/techsessions/2022/PalmSprings/ImprovingYourDockpaneandProWindo...) , all 2022 tech sessions are here, the one you want to look at is called ' Improving Your Dockpane and ProWindow':
Tech Sessions · Esri/arcgis-pro-sdk Wiki (github.com)
This looks suspect to me - the await on the Task.Delay.
await QueuedTask.Run(async () =>
{
...
await Task.Delay(1000);
I think if u change your code to:
await QueuedTask.Run(() =>
{
Task.Delay(1000).Wait();//block
You will get the effect u are after. Also, 1000 might be a little bit too quick. 2000+ may be better. Scratch that - u r in a loop, 1000 is fine. From memory I think there is an option on the ProgressDialog ctor - delayedShow. Default is true so u can set that to false to have the dialog immediately show. Last, I dont think the progress.Hide() is necessary.