How to stope Execution of ICommand object?

697
1
06-24-2021 04:35 AM
TapasChakrabarty
New Contributor III

Hi,

I have below code part which identifies the MapTool and execute it through ICommand object. But after I am done with the purpose how to stop the execution?

var iCommand = FrameworkApplication.GetPlugInWrapper(commandId) as ICommand;
  if (iCommand != null)
  {
    // Let ArcGIS Pro do the work for us
    if (iCommand.CanExecute(null))
    {
      iCommand.Execute(null);
    }
  }

 The above code launch MapTool so I want to stop it from code as well.

0 Kudos
1 Reply
BrentHoskisson
Occasional Contributor III

An ICommand is something that starts and runs until it is done.  If this is your constraint, you may need a second ICommand object to do the stopping.

There is also an ITool interface which has a Deactivate function, if you can change your design.

Good Luck

Brent Hoskisson

 

 

0 Kudos