ActionExecutor is a context-dependent technology. It allows execution of various operations using one Action. In so doing, the actual functionality is determined by the type of object which is used as the context. Action can be executed by the user from an UI, or by the system.
Let's look following example:
There are two persistent types: FirstObjectType and SecondObjectType. Both types have FirstValue, SecondValue, and ThirdValue properties. There are also one Simple Action, named «Execute». After Simple Action executing in the FirstObjectType context the ThirdValue will be equal to FirstValue+SecondValue. After Simple Action executing in the SecondObjectType context the ThirdValue will be equal to FirstValue-SecondValue.
As you can see in the application screenshots, one Simple Action provides two different functionality:
Objects implementing IActionExecutorProvider interface can be used as the context. IActionExecutorProvider declare CreateActionExecutor() method which returns a new object implementing IActionExecutor interface:
public static IActionExecutor CreateActionExecutor(SomeObjectType instance)
Public Shared Function CreateActionExecutor(ByVal instance As SomeObjectType) As IActionExecutor
Some members of the IActionExecutor interface are listed below:
- event EventHandler Finalized;
occur when execution of the Execute() (or DoExecute()) method is completed.
- void OnFinalized(EventArgs e);
raises the Finalized event
- void Execute(SimpleAction sender, SimpleActionExecuteEventArgs e);
starts execution of SimpleAction when the user clicks the button.
- void DoExecute();
starts execution of Simple Action by the system.
A Simple Action for context-dependent executing must be added to special ViewController, which derived from the abstract ActionExecutorViewController.
To learn more about the ActionExecutor, refer to the following documents: