How do you iterate a Progressor?

1539
2
07-07-2016 08:42 AM
TedChapin
Occasional Contributor III

I want to show a progressor while I loop through the selected features and do stuff and let the user know how long it will take.  I can get the Progressor to display, but it only goes from left to right, then starts over at the left and continues this until it's done.  I set progressor.Max to the count of selected features and inside my loop (while cursor.MoveNext()) I do progressor.Value += 1, but I can't get it to start on the left and go to the right, stopping when value = max.

0 Kudos
2 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Ted,

I you use the sample @ https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/ProgressDialog and make the update below in the "RunDialogButtonsCancel" class you will get the desired effect.  I will update the sample soon to reflect this capability.  The trick is to create your own ProgressDialog instance and specify the 'maximum steps' parameter.

protected override async void OnClick()

{   //If you run this in the DEBUGGER you will NOT see the dialog

      uint maxSteps = 5;

      var pd = new ArcGIS.Desktop.Framework.Threading.Tasks.ProgressDialog(

                "Doing my thing - cancelable", "Canceled", maxSteps, false);

       await

                ProgressDialogModule.RunCancelableProgress(

                    new CancelableProgressorSource(pd), maxSteps);

}

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Ted,

I updated the sample @ https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/ProgressDialog and added a progress dialog that iterates through a given number of steps as shown in my post above (see the readme.md for a screenshot of this functionality).