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="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry 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">
<Name>ProAppModule2</Name>
<Description>ProAppModule2 description</Description>
<Image>Images\AddinDesktop32.png</Image>
<Author>User</Author>
<Company>Company</Company>
<Date>3/28/2024 10:01:36 AM</Date>
<Subject>Framework</Subject>
<!-- Note subject can be one or more of these topics:
Content, Framework, Editing, Geodatabase, Geometry, Geoprocessing, Layouts, Map Authoring, Map Exploration -->
</AddInInfo>
<modules>
<insertModule id="ProAppModule2_Module" className="Module1" autoLoad="false" caption="Module1">
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<!--<tab id="ProAppModule2_Tab1" caption="New Tab">
<group refID="ProAppModule2_Group1"/>
</tab>-->
</tabs>
<groups>
<!-- 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" />
</group>
</groups>
<controls>
<!-- 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>
</button>
</controls>
</insertModule>
</modules>
</ArcGIS>
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 box