Kanzi  3.9.7
Kanzi Studio API
TriggerActionItem Interface Reference

Configure trigger actions. More...

Public Member Functions

void SetForwardArgument (string argumentPropertyName, EventArgumentValueTypeEnum argumentValueType, object value)
 Sets the message trigger argument to either a fixed value or to take the value from a property that you set. More...
 
void SetForwardArguments (IEnumerable< Property > argumentPropertyTypes)
 Sets the trigger arguments. More...
 

Properties

int Delay [get, set]
 Gets or sets the delay in milliseconds after which the trigger sets off the action. More...
 
MessageType DispatchMessageActionMessageType [get, set]
 Gets or sets the Message Type. More...
 
ProjectItemReference< ExportedPropertyContainerItem > RoutingTarget [get, set]
 Gets or sets the Target Item to which the action dispatches the message. More...
 
TriggerActionType TriggerActionType [get]
 Gets the Trigger Action Type. More...
 

Detailed Description

Configure trigger actions.

See also
TriggerNodeComponent, TriggerConditionItem, NodeComponentHost

Examples

To create a dispatch message action and set the Message Type (DispatchMessageActionMessageType), Target Item (RoutingTarget), and Action Delay (Delay) properties:

// This example creates two Page nodes, Intro and Main, in the RootPage node, and sets the Default Subpage
// property of the RootPage node to Intro. It then adds a Navigate to Page action to the Page Activated trigger
// in the Intro Page node. The action is set off after a delay of two seconds and navigates to the Main Page node.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Page node named Intro in the RootPage node.
var introPage = studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Intro"), rootPage);
// Set the Default Subpage property of the RootPage node to the Intro node.
rootPage.Set(Properties.PageHostDefaultSubPage.Name, "Intro");
// Create a Page node named Main in the RootPage node.
studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Main"), rootPage);
// Get the first Page Activated trigger in the Intro Page node.
var pageActivatedTrigger =
introPage.Triggers.First(trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Page.Activated"));
// In the Page Activated trigger create a trigger action, and set:
// * Trigger Action Type to Dispatch Message Action
// * Message Type to Navigate To Page
var navigateToPageAction = pageActivatedTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.DispatchMessageAction"));
navigateToPageAction.DispatchMessageActionMessageType = studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Page.Navigate");
// In the Navigate To Page action use a relative path to set Target Item to the Main Page node.
navigateToPageAction.RoutingTarget = new NodeReference<Page>("../Main");
// In the Navigate To Page action set Action Delay to 2000 ms.
navigateToPageAction.Delay = 2000;
}

Member Function Documentation

void SetForwardArgument ( string  argumentPropertyName,
EventArgumentValueTypeEnum  argumentValueType,
object  value 
)

Sets the message trigger argument to either a fixed value or to take the value from a property that you set.

Parameters
argumentPropertyNameMessage argument name
argumentValueTypeMessage argument value type:
  • FIXED for the fixed value
  • FORWARD_TRIGGER_ARGUMENT or FORWARD_PROPERTY for the forward argument
valueFor the fixed value argument: data type. For the forward arguments: property type.
void SetForwardArguments ( IEnumerable< Property argumentPropertyTypes)

Sets the trigger arguments.

Property Documentation

int Delay
getset

Gets or sets the delay in milliseconds after which the trigger sets off the action.

MessageType DispatchMessageActionMessageType
getset

Gets or sets the Message Type.

See also
Project.MessageTypeLibrary
ProjectItemReference<ExportedPropertyContainerItem> RoutingTarget
getset

Gets or sets the Target Item to which the action dispatches the message.

TriggerActionType TriggerActionType
get

Gets the Trigger Action Type.

See also
Project.TriggerActionTypeLibrary