// For a System toolbox, to identify the specific tool to show, use
// either:
// o "ToolboxName.ToolName" - eg "analysis.Buffer"
// o "Fullpath to Toolbox.tbx\Toolname" - eg:
// "C:\ArcGIS\Resources\ArcToolBox\Toolboxes\Analysis Tools.tbx\Buffer"
// note:
// For legacy purposes, the convention "ToolName_ToolBox" is also supported so,
// o "Buffer_analysis" would also work
//
// For a custom toolbox, the full path must be provided. So, for example,
// given the custom toolbox "DeepThought.tbx" containing a python script tool
// called "Answer", installed at "C:\Data\DeepThought-ProAddin\Toolboxes\toolboxes",
// the full path would be:
// o "C:\Data\DeepThought-ProAddin\Toolboxes\toolboxes\DeepThought.tbx\Answer"
//Open the Buffer Tool GP Dialog - use either the full path or just
//use "ToolboxName.ToolName"
var path = @"C:\ArcGIS\Resources\ArcToolBox\Toolboxes\Analysis Tools.tbx";
var full_tool_name = System.IO.Path.Combine(path, "Buffer");
var short_tool_name = "analysis.Buffer";
var tool_name = short_tool_name;//or full_tool_name
var extent = MapView.Active.Extent;
var val_array = await QueuedTask.Run(() =>
{
var rect = GeometryEngine.Instance.Scale(extent, extent.Center, 0.25, 0.25) as Envelope;
var poly = PolygonBuilderEx.CreatePolygon(rect, rect.SpatialReference);
var geom = new List<object>() { poly };
return Geoprocessing.MakeValueArray(new object[] { geom, null, @"1000 Meters" });
});
//Call OpenToolDialog on the UI thread!
Geoprocessing.OpenToolDialog(tool_name, val_array, null, false);