5

I have an ArcGIS custom IGPFunction tool. I want to use the GP progress dialog not the progress bar at the bottom of the ArcGIS 10 window as I don't want people to interact with the map whilst it's processing.

In the Execute method you have an instance of ITrackCancel but I can't work out how to show the default GP progress dialog from there. I have this as code at the moment but it still doesn't show the dialog. Any ideas?

        IStepProgressor pStepPro = (IStepProgressor)TrackCancel;
        pStepPro.MinRange = 0;
        pStepPro.StepValue = 1;
        pStepPro.Message = "Starting Import...";
        pStepPro.Position = 0;
        pStepPro.Show();

        ...

        pStepPro.Hide();
  • +1 - I'd like to know the answer to this, as well. Currently, I implement a backgroundworker and disable certain buttons in a winform with little way to display any sort of tool progress. When the tool can take over an hour, it would be great to show the normal progress dialog. I wonder if an answer could be extended to standalone tools. – Nathanus Dec 20 '11 at 17:10
3

This is built-in to the Geoprocessing framework. If you have background processing turned on, you shouldn't block the UI. At all. It violates the principles of Geoprocessing -- what if you run the tool as a scheduled task, or in modelbuilder, or from Python?

If you absolutely HAVE to, two things:

I recommend checking if you're in a desktop application before bringing up a dialog by trying to create the AppRef class first -- if that fails, don't pop up a dialog.

But really, you shouldn't be second-guessing the user's preference for background/foreground processing. I'll assume in good faith you really do need this.

  • Yes I do need to do this. The progress dialog doesn't work for me, nothing displays. Strangely IGPUtilities2:InApplication is returning false. Even though it's being run from ArcToolbox. – Rob Jan 11 '12 at 8:49
  • Wow, that sounds like a broken install to me. – Jason Scheirer Jan 11 '12 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.