Visualize long running Task in Dockpane

944
1
08-03-2021 12:59 AM
Fabeabe
New Contributor

Hi all!

I've created a dockpane that executes a long running process.

My Customer wants my AddIn to visualize its Progress exactly like the Progress in the Geoprocessing-Tools with an Details-Dialoge (Screenshots).

Is there any Documentation about a Progressbar like that or any Community-Sample?
I've only found WPF-ProgressBar, Spinner and the ProgressDialog but not the one I'm searching for.

0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

The Geoprocessing tool's dockpane is using a third party control(s) for its user interface including the progress bar.  Unfortunately this control is not available through the Pro SDK's API.  You can however, style a WPF Progressbar control to match the Geoprocessing's progress bar.   The Overlay3D community sample is using a progress bar on a dockpane:  arcgis-pro-sdk-community-samples/Map-Exploration/Overlay3D at master · Esri/arcgis-pro-sdk-community...

As with all WPF controls you have to make sure that you update any WPF properties only on the GUI thread.  To show progress from a background or worker thread (like from within QueuedTask.Run() ) you have to update the ProgressValue property of the WPF progress bar on the GUI thread, which you can do by using the Dispatcher's Invoke method:

System.Windows.Application.Current.Dispatcher.Invoke(() => {
  // update your WPF property here:
  ProgressValue++;
});