var plugin = FrameworkApplication.GetPlugInWrapper("esri_editing_EditVerticesText"); if (plugin.Enabled) ((ICommand)plugin).Execute(null);
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_editing_ShowAttributes"); var command = wrapper as ICommand; // tool and command(Button) supports this if ((command != null) && command.CanExecute(null)) command.Execute(null);
// use SetCurrentToolAsync FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool"); // or use ICommand.Execute ICommand cmd = FrameworkApplication.GetPlugInWrapper("esri_mapping_selectByRectangleTool") as ICommand; if ((cmd != null) && cmd.CanExecute(null)) cmd.Execute(null);
// Get the job Id associated with a running OpenProItems step for a Pro Add-In module // In the Add-In Module class, override the ExecuteCommandArgs(string id) method and return a Func<Object[], Task> object like the sample below // Refer to the Workflow Manager ProConcepts Sample Code link for an example //protected override Func<Object[], Task> ExecuteCommandArgs(string id) //{ // return func1; //} Func<Object[], Task> func1 = (object[] args) => QueuedTask.Run(() => { try { // Get the jobId property from the OpenProProjectItemsStep arguments and store it. OpenProProjectItemsStepCommandArgs stepArgs = (OpenProProjectItemsStepCommandArgs)args[0]; var jobId = stepArgs.JobId; ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Got job id from ProMappingStep args: {jobId}", "Project Info"); // Run the command specified by the id passed into ExecuteCommandArgs IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(id); var command = wrapper as ICommand; if (command != null && command.CanExecute(null)) command.Execute(null); } catch (System.Exception e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"ERROR: {e}", "Error running command"); } });
Target Platforms: Windows 11, Windows 10