We developed a python toolbox with one python script. The script doesnot need any parameters set, it just needs to run multiple times. The toolbox is now integrated in an add-in, which works with "Geoprocessing.OpenToolDialog(toolboxPath, null);" and then hitting run. Using this method, we could run the tool and still execute other geoprocessing tools.
Since we dont use any parameters, hitting "Run" is not needed. We found the "ExecuteToolAsync" which runs the tool, but async-style, meaning while this function is running, nothing else can be processed.
We need a function, which combines these two: clicking the add-in button will execute the function and it will be executed in a way, so that other geoprocessing tools can run too. Does such a function exist? and if yes, how is it called?
Here is my Code from the Button.cs, which will be called in the Config.daml:
using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Catalog;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Core.Geoprocessing;
using ArcGIS.Desktop.Editing;
using ArcGIS.Desktop.Extensions;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Layouts;
using ArcGIS.Desktop.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ToolTest
{
internal class Button1 : Button
{
protected async override void OnClick()
{
string installPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string toolboxPath = Path.Combine(installPath, "toolbox.pyt\\Tool");
await Geoprocessing.ExecuteToolAsync(toolboxPath,null,null,null,null, GPExecuteToolFlags.InheritGPOptions);
}
}
}