C#, How to stop Command from executing by checking the conditions in Command.BeginCommand?


I’m currently having a requirement that require me to check the current condition before executing new Command. So what I’m trying to do now is to have the condition checks in “Command.BeginCommand” event and if it does not meet the condition, do not execute the Command.

However the problem is, in “Command.BeginCommand” does not have any return values to indicate if the command is to be canceled. Are there any other ways to achieve this without needing to implement the checks in every commands class?

This this for one of your commands or any command?

If the user starts a command, there is no good/easy way of canceling it’s execution from a plug-in.

– Dale

It is for any commands, so does it mean there is still a way to make it possible?

Sorry, no.

Thanks for the clarification! :slight_smile: