Class AbstractAction
Abstract base class for user actions, which can be added to a command bar.
Inherited Members
Namespace: SdlSdl.DesktopIntegrationApi
Assembly: Sdl.Desktop.IntegrationApi.dll
Syntax
public abstract class AbstractAction : IAction, IExtensionAware
Constructors
AbstractAction()
Declaration
protected AbstractAction()
Properties
ActionAttribute
Gets the action attribute.
Declaration
public ActionAttribute ActionAttribute { get; }
Property Value
Type | Description |
---|---|
ActionAttribute | The action attribute. |
ActionGroup
Gets or sets the action group this action is part of. This property is only valid when the action style (Style property is set to ToggleButton.
Declaration
public string ActionGroup { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
When null, the action is shown on the command bar as a checkbox, otherwise it is shown as a radio button.
Available
Gets or sets whether this action is currently available.
Declaration
public bool Available { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If an action is not available, it is not shown on the command bar.
Checked
Gets or sets whether this action is checked. This property is only valid when the action style (Style property is set to ToggleButton.
Declaration
public bool Checked { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Setting this property to true when the action has been added to a command bar will result in the Execute() method being called.
DisplayType
Gets or sets the ribbon action size.
Declaration
public DisplayType DisplayType { get; set; }
Property Value
Type | Description |
---|---|
DisplayType |
Remarks
This should be set before adding the action to a commandbar.
Enabled
Gets or sets whether this action is currently enabled.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
If an action is not enabled, it is shown is greyed out on the command bar.
Extension
Gets or sets the extension.
Declaration
public IExtension Extension { get; set; }
Property Value
Type | Description |
---|---|
IExtension | The extension. |
Icon
Gets or sets the icon for this action. Can be null.
Declaration
public Icon Icon { get; set; }
Property Value
Type | Description |
---|---|
Icon |
Id
Gets or sets the unique id for this action.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
This id is unique across the Studio.
Style
Gets or sets the action style.
Declaration
public ActionStyle Style { get; set; }
Property Value
Type | Description |
---|---|
ActionStyle |
Remarks
This should be set before adding the action to a commandbar.
Text
Gets or sets the text for this action.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
Can contain an ampersand to indicate the mnemonic character.
ToolTipText
Gets or sets the tooltip test for this action.
Declaration
public string ToolTipText { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
Execute()
Called when the user activates this action. Override this method to perform the action logic.
Declaration
protected abstract void Execute()
Initialize()
Executed when the action is initialized.
Declaration
public virtual void Initialize()
OnPropertyChanged(ActionPropertyChangedEventArgs)
Raises the PropertyChanged event.
Declaration
protected virtual void OnPropertyChanged(ActionPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
ActionPropertyChangedEventArgs | e | The event arguments. |
Remarks
When overriding this method, make sure to call the base class implementation, so the event is raised.
Events
AfterActionExecuted
Called after action is executed
Declaration
public event EventHandler<ActionExecutionEventArgs> AfterActionExecuted
Event Type
Type | Description |
---|---|
EventHandlerActionExecutionEventArgs |
BeforeActionExecuted
Called before action is executed
Declaration
public event EventHandler<ActionExecutionCancelEventArgs> BeforeActionExecuted
Event Type
Type | Description |
---|---|
EventHandlerActionExecutionCancelEventArgs |
PropertyChanged
Raised when the value of one of the action's properties changed.
Declaration
public event EventHandler<ActionPropertyChangedEventArgs> PropertyChanged
Event Type
Type | Description |
---|---|
EventHandlerActionPropertyChangedEventArgs |
Remarks
For possible property values, see the constants defined in ActionProperties.