add-in MessageBox in sync with geoprocessing tool

04-02-2024 11:33 AM
New Contributor II

Hello, I am trying to generate a UI message box  if my python toolbox fails. That way it is apparent to an analyst that an error has occurred. The toolbox needs to run in ArcPro. So it is separate from  the .NET framework. I am using ArcPro SDK Version 3.0 and use ArcPro 3.0.3. I have a basic example with SDK that I created: a button add-in. 



Here is the config.daml :



<ArcGIS defaultAssembly="ProAppModule2.dll" defaultNamespace="ProAppModule2" xmlns="" xmlns:xsi="" xsi:schemaLocation=" file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
  <AddInInfo id="{6e4b01b2-c416-4d9a-9c65-c0474d5093ec}" version="1.0" desktopVersion="3.0.36057">
    <Description>ProAppModule2 description</Description>
    <Date>3/28/2024 10:01:36 AM</Date>
    <!-- Note subject can be one or more of these topics:
                    Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->
    <insertModule id="ProAppModule2_Module" className="Module1" autoLoad="false" caption="Module1">
      <!-- uncomment to have the control hosted on a separate tab-->
        <!--<tab id="ProAppModule2_Tab1" caption="New Tab">
          <group refID="ProAppModule2_Group1"/>
        <!-- comment this out if you have no controls on the Addin tab to avoid
              an empty group-->
        <group id="ProAppModule2_Group1" caption="Project Test Tool" appearsOnAddInTab="true">
          <!-- host controls within groups -->
          <button refID="ProAppModule2_Button1" size="large" />
        <!-- add your controls here -->
        <button id="ProAppModule2_Button1" caption="WKT Import" className="Button1" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue32.png">
          <tooltip heading="Tooltip Heading">Tooltip text<disabledText /></tooltip>



 Button1.cs : 



namespace ProAppModule2
    internal class Button1 : Button
        protected override void OnClick()
            //string stringURI = ArcGIS.Desktop.Core.Project.Current.URI;
            //ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Project path: {stringURI}", "Project Info");
            MessageBox.Show("Query returned no results. Please select a different AOI boundary.", "Error");





 The add-in shows correctly in arcpro. However I need a way for the python toolbox to be in sync with the add in and for the add in to just run without user action on my part. The python toolbox failing initiates the action to run the add-in and display the message box. Is this possible ?

Here is what the message box looks like:

error message boxerror message box

0 Kudos
2 Replies
Esri Regular Contributor


A .NET Addin can launch Geoprocessing tools (and display messages). Consult this doc for the various ways by which you use the .NET Pro SDK to run GP Tools: ProConcepts: Geoprocessing 


0 Kudos
New Contributor II

Thanks for the reply! I did get a chance to look at the geoprocessing doc. The use case I am going after is that the SDK needs to become aware of an external process(an event). The event being a python toolbox being executed manually from ArcPro (from an analyst perspective).

I can’t seem to find a namespace in the API that will let me subscribe to an external process since the tool and its parameters must be run inside the SDK. 

Once the SDK becomes aware of a tool being run manually and the tool completes or fails, it generates a message box. 

0 Kudos