Implement UI Tools action

  1. First, implement an action that inherits from ServerIntentActionBase:
  2. Next, implement a constructor, which either passes true or false to the modifiesProject parameter of the base constructor. True is passed if the action is going to modify the project:
  3. Override the OnExecute() method. OnExecute must contain the code that is run on the server in response to the client-side event. The following is an example implementation that adds a child block dynamically:

    The parameter passed called targets is an array of parts, but it always has one item: the part that is selected on the UIPartsTree. Notice that IntentAPI is available. At the end of the method, the ExecuteComplete() method must be called. This notifies the UITools that the action is complete, and the UI can be updated.

  4. Override the properties in the base class. The Name property specifies the name of the action in the Actions rule:
    The MenuText, Category, and MenuImage properties specify how the action appears on the ribbon:
    The following image shows the results of this action. You can use any 32x32 image in the Resources file.
  5. Override the properties that define various behaviors of the action:

    These settings work for most actions. The ServerAction property is an exception. To update the UI after the action is complete, set it to UpdateModel. Otherwise, set it to ReturnResult.