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:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var introPage = studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Intro"), rootPage);
rootPage.Set(Properties.PageHostDefaultSubPage.Name, "Intro");
studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Main"), rootPage);
var pageActivatedTrigger =
introPage.Triggers.First(trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Page.Activated"));
var navigateToPageAction = pageActivatedTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.DispatchMessageAction"));
navigateToPageAction.DispatchMessageActionMessageType = studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Page.Navigate");
navigateToPageAction.RoutingTarget = new NodeReference<Page>("../Main");
navigateToPageAction.Delay = 2000;
}