ProgressDialog not showing even without debugging mode .net sdk

867
5
Jump to solution
01-14-2023 09:03 PM
JohnP18
New Contributor II

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??

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

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.

View solution in original post

0 Kudos
5 Replies
GKmieliauskas
Esri Regular Contributor

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 

JohnP18
New Contributor II

@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.

0 Kudos
GKmieliauskas
Esri Regular Contributor

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.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

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)

Wolf_0-1673886029129.png

 

0 Kudos
CharlesMacleod
Esri Regular Contributor

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.

0 Kudos