ssporik721

Custom Model Listening Events in .NET

Discussion created by ssporik721 on Aug 12, 2011
I have a large custom Geoprocessing model being executed from a button on a tool bar in ArcMap.

I have followed the example at:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Walkthrough_Consuming_a_geoprocessing_model_tool_in_NET/0001000001sw000000/

creating a GP object and managing the properties through VB.NET, eventually calling the GP.Execute method to begin the model.

This works simply to run the model, but there is no native notification to the user that the model is being successfully executed, so I implemented IProgressDialogFactory and wired up GPMessageEventHandler in effort to provide a modal dialog that will show the progress of the custom model. 

Used References:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Sample_Geoprocessing_events_listener/00010000033q000000/

http://forums.esri.com/Thread.asp?c=93&f=993&t=278556&mc=3#msgid888048

The model is very large with over 300 steps in 10 sub models.  In most cases it takes over 6 minutes to run, just to produce one table.  I liken it to Willy Wonka's gobstopper machine, makes a bunch of noise just to produce one small output.

Anyway,  the listening events are interfaced with the GP object, which is seen by the event handler as one tool.  So the modal dialog appears with a status bar, that stays at 0% until the entire model is complete 6 minutes later which then moves directly to 100%.  There is no indication to the user that the processes are underway.  I also catch the message output of the GP object and try to display the current step the model is running, but because the entire model is viewed as one tool it never gets past the first step, until the entire model is complete.

Is there a way to breakdown the GP object, or the listeningevents to monitor the processes that are being executed inside the model so that I can provide the user with real time status of the processes being performed.  Our end users are not ArcGIS savy, and the modal dialog as it is now presents a challenge for novice users to understand that the model does work, and that ArcMap is NOT crashing on them.

Thanks for your suggestions.
I can gladly post code if that helps.

Outcomes