ActionBuilder Class |
Namespace: Kjs.AppLife.Update.Engine.Core.Design
The ActionBuilder type exposes the following members.
Name | Description | |
---|---|---|
![]() | ActionBuilder |
Initializes a new instance of the ActionBuilder class.
|
Name | Description | |
---|---|---|
![]() | CleanupAfterBuild |
Performs any work needed after building the project.
|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Initialize |
Prepares the builder to work with an action.
|
![]() | InitializeExistingAction |
Initializes the ActionBuilder and its action
after Action has been set to an action that has been loaded.
|
![]() | InitializeNewAction |
Initializes the ActionBuilder and its action
after Action has been set to a newly created
action.
|
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnActionChanged |
Raises the ActionChanged event.
|
![]() | OnDescriptionChanged |
Raises the DescriptionChanged event.
|
![]() | OnDisplayTextChanged |
Raises the DisplayTextChanged event.
|
![]() | OnImageChanged |
Raises the ImageChanged event.
|
![]() | OnIsValidChanged |
Raises the IsValidChanged event.
|
![]() | OnValidationErrorsChanged |
Raises the ValidationErrorsChanged event.
|
![]() | PrepareForBuild |
Performs any work needed to prepare Action for building.
|
![]() | SetActionDirty |
Raises the ActionChanged event, causing the action to be
considered dirty, or changed, by the project it belongs to.
|
![]() ![]() | StartEditingAction |
Starts editing the builder's action.
|
![]() | ToString | (Inherited from Object.) |
![]() | ValidateAction |
Checks the state of Action to ensure that it is valid.
|
![]() | ValidateActionCore |
Performs the work of checking the state of Action to ensure that
it is valid.
|
Name | Description | |
---|---|---|
![]() | Action |
Gets the UpdateAction associated with the builder.
|
![]() | Description |
Gets or sets a description of the action.
|
![]() | DisplayText |
Gets or sets the text used to represent the builder's Action to the user
when Description is blank.
|
![]() | Image |
Gets or sets the image used to represent the builder's Action to the user.
|
![]() | IsValid |
Gets a value indicating whether the builder's Action is valid.
|
![]() | ValidationErrors |
Gets a ValidationErrorCollection containing any validation errors for the action.
|
Name | Description | |
---|---|---|
![]() | ActionChanged |
Occurs when Action's data changes.
|
![]() | DescriptionChanged |
Occurs when the Description property value changes.
|
![]() | DisplayTextChanged |
Occurs when the DisplayText property value changes.
|
![]() | ImageChanged |
Occurs when the Image property value changes.
|
![]() | IsValidChanged |
Occurs when the IsValid property value changes.
|
![]() | ValidationErrorsChanged |
Occurs when the contents of the ValidationErrors property value changes.
|
An ActionBuilder can provide the following for an UpdateAction:
To create a custom ActionBuilder, inherit from this class and provide a public parameterless constructor. To link an ActionBuilder to an UpdateAction, provide an ActionBuilderAttribute on the UpdateAction, specifying the type of the ActionBuilder. If the type specified in the ActionBuilderAttribute cannot be found, does not inherit from ActionBuilder, or does not have a public, parameterless constructor, the default ActionBuilder will be used instead.
To specify a custom editor, override the StartEditingAction(IServiceProvider) method and use the provided IServiceProvider to to present your custom editor. Note that any custom action editor must ensure that SetActionDirty and ValidateAction are called as needed.
To provide validation for an action, override ValidateActionCore(ValidationErrorCollection) and add any validation errors to the provided collection.
To provide initialization, override InitializeNewAction to initialize newly created actions and InitializeExistingAction to initialize loaded actions.
To customize the action's appearance, set the DisplayText and Image properties.
using Kjs.AppLife.Update.Engine.Core; using Kjs.AppLife.Update.Engine.Core.Design; [ActionBuilder(typeof(DelayActionBuilder))] public class DelayAction : UpdateAction { private int mSeconds; public DelayAction() { } public int Seconds { get { return this.mSeconds; } set { this.mSeconds = value; } } public override void Execute(UpdateContext context) { System.Threading.Thread.Sleep(mSeconds * 1000); } public override void RollbackExecute(UpdateContext context) { } } public class DelayActionBuilder : ActionBuilder { public DelayActionBuilder() { } private new DelayAction Action { get { return (DelayAction)base.Action; } } protected override void ValidateActionCore(ValidationErrorCollection errors) { if(this.Action.Seconds < 0) { errors.AddError("Seconds cannot be less than 0."); } } }