Prevent Command Execute by using CommandBegin Event

Prevent Command Execute by using CommandBegin Event

gbadziura
Enthusiast Enthusiast
826 Views
4 Replies
Message 1 of 5

Prevent Command Execute by using CommandBegin Event

gbadziura
Enthusiast
Enthusiast

Hi All

 

I'm trying to prevent a command execution by using the CommandBegin event, but it seems, that there is no cancle or handled property to stop the execution.

 

I Need this because not for all Commands exist an Event like Checkin or Check out.

 

Anyone has an idea???

 

Regards

 

Gerhard

0 Likes
827 Views
4 Replies
Replies (4)
Message 2 of 5

wayne.brill
Collaborator
Collaborator

Hi Gerhard,

 

Which commands are you trying to cancel? 

 

This post discusses using multiple events (not sure if it will help)

http://justonesandzeros.typepad.com/blog/2011/09/vault-explorer-command-events.html

 

Thanks,

Wayne

 

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

gbadziura
Enthusiast
Enthusiast

Hi Wayne

 

I want to have the possibility to cancle every UI Command depending on diffrent conditions. So, for example, i am able to prevent renaming of files if the user is member of an certain Group. He must have the right to Change files but with this he ist not able to use the rename command.

 

 

Hope this makes it a little bit more clear.

 

regards Gerhard. 

 

P.S. I tried to throw an exeption but the command was not influenced by this.

0 Likes
Message 4 of 5

wayne.brill
Collaborator
Collaborator

Hi Gerhard,

 

Could you use the DocumentService.CheckoutFileEvents.GetRestrictions and restrict the checkout if the user does not meet the requirement?

 

I used this example to test and when I renamed a file. It was restricted when I had the "CheckoutFile Command" clicked. (using the Configurator project in the solution)

C:\Program Files (x86)\Autodesk\Autodesk Vault 2016 SDK\vs12\CSharp\RestrictOperations

 

Currently there is not a way to cancel the command with the IApplication.CommandBegin event. You could request it on the Vault Idea Station:

https://forums.autodesk.com/t5/vault-ideas/idb-p/2/tab/most-recent

 

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 5

gbadziura
Enthusiast
Enthusiast

Hi Wayne

 

Rename was just an example. WebserviceEvents is not in every case a soulution. What i dont understand is, why are the events implemented if i am only able to do something bevor and after without the possibility to influence the command itself.

 

So i put it to the IdeaStation.

 

Regards

 

Gerhard

 

 

0 Likes