Kanzi 4.1.0
TriggerNodeComponent Interface Reference

Configure triggers. More...

Inheritance diagram for TriggerNodeComponent:
[legend]
Collaboration diagram for TriggerNodeComponent:
[legend]

Public Member Functions

TriggerActionItem CreateAction ([NotNull] TriggerActionType actionType)
 Creates a trigger action.
 
TriggerConditionItem CreateCondition ()
 Creates a trigger condition.
 
TriggerConditionItem CreateCondition ([NotNull] TriggerConditionItem toClone)
 Creates a trigger condition by cloning an existing trigger condition.
 
bool DeleteAction ([NotNull] TriggerActionItem action)
 Deletes a trigger action.
 
bool DeleteCondition ([NotNull] TriggerConditionItem condition)
 Deletes a trigger condition.
 
- Public Member Functions inherited from ProjectItem
void AddProperty (Property property)
 Adds a property to an item.
 
void AddProperty (string propertyName)
 Adds a property to an item.
 
void BeginBatchModification (string batchName)
 Begins a batch modification operation.
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
void CommitBatchModification ()
 Commits the current batch modification operation.
 
bool Delete ()
 Deletes a project item.
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user.
 
IEnumerable< PropertyGetAddableProperties ()
 Gets a list of properties which you can add to an item.
 
T GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree.
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name.
 
T GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type.
 
int GetChildIndex (ProjectItem child)
 Gets the index of a child project item within this item's children collection.
 
IEnumerable< PropertyGetContextProperties ()
 Gets the context properties for this project item.
 
IEnumerable< PropertyGetFixedProperties ()
 Gets the fixed properties for this project item that cannot be removed.
 
IEnumerable< PropertyGetFrequentlyAddedProperties ()
 Gets the properties that are frequently added to this type of project item.
 
ProjectItem GetProjectItemByPath (string path)
 Gets a project item by its path relative to this project item.
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 Gets the relative path from this project item to another project item.
 
IEnumerable< PropertyGetRemovableProperties ()
 Gets a list of properties which you can remove from an item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item.
 
IEnumerable< ProjectItemGetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children.
 
bool HasProperty (Property property)
 Checks whether an item has a specific property.
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property.
 
bool IsPropertyReadOnly (Property property)
 Checks whether the specified property is read-only on this project item.
 
void RegisterThumbnailUser (object user, uint width, uint height, bool showChildren, bool showFullScreen, Node contextNode)
 Registers a user for the thumbnail images for a project item.
 
void RemoveProperty (Property property)
 Removes a property from an item.
 
void RemoveProperty (string propertyName)
 Removes a property from an item.
 
void SetChildIndex (ProjectItem child, int index)
 Sets the index of a child project item within this item's children collection.
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 Sets the read-only status of the specified property on this project item.
 
void UpdateValidity ()
 Recalculates the validity the item.
 
- Public Member Functions inherited from PropertyContainer
object Get (Property property)
 Gets the value of a property.
 
object Get (string propertyName)
 Gets the value of a property.
 
T Get< T > (TypedProperty< T > property)
 Gets the value of a property.
 
void Set (string propertyName, object value)
 Sets the value of a property.
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property.
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name.
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid.
 
- Public Member Functions inherited from BindingHost
Binding CreateBinding (Binding sourceBinding)
 Creates a binding by copying an existing binding.
 
Binding CreateBinding (Property property, AnimationTargetPropertyAttributeEnum attribute, string code, BindingTypeEnum bindingMode, NodeReferenceBase pushTarget)
 Creates and configures a binding.
 
Binding CreateBinding (Property property, AnimationTargetPropertyAttributeEnum attribute, string code, BindingTypeEnum bindingMode=BindingTypeEnum.ONE_WAY)
 Creates and configures a One Way binding.
 
void DeleteBinding (Binding binding)
 Deletes a binding.
 

Properties

IEnumerable< TriggerActionItemActions [get]
 Gets the actions in a trigger.
 
IEnumerable< TriggerConditionItemConditions [get]
 Gets the conditions in a trigger.
 
bool IsMessageTrigger [get]
 Gets whether the trigger is a message trigger.
 
Node MessageSource [get, set]
 Gets or sets the target item from which to intercept messages.
 
new TriggerNodeComponentProperties PropertyTypes [get]
 
NodeReference< NodeRelativeMessageSource [get, set]
 
MessageRoutingModeEnum RoutingMode [get, set]
 Gets or sets the message routing mode:
 
bool SetHandled [get, set]
 Gets or sets the message handling mode:
 
MessageType TriggerMessageType [get]
 Gets the Trigger Message Type.
 
- Properties inherited from NodeComponent
NodeComponentType NodeComponentType [get]
 
- Properties inherited from ProjectItem
IEnumerable< ProjectItemChildren [get]
 Gets all child items of a project item.
 
string IconLocation [get]
 Gets the location of the icon for this project item in Kanzi Studio.
 
object IconModifier [get, set]
 Gets or sets the icon modifier for this project item.
 
string InvalidityReason [get]
 Gets the reason why this project item is in an invalid state, or null if the item is valid.
 
bool IsDeleted [get]
 Gets whether this project item has been deleted.
 
bool IsDisposed [get]
 Gets whether this project item has been disposed.
 
bool IsHidden [get, set]
 Gets or sets whether this project item is hidden in Kanzi Studio.
 
bool IsReadOnly [get, set]
 Gets or sets whether this project item is read-only.
 
bool IsValidState [get]
 Gets whether this project item is in a valid state.
 
string KzbUrl [get]
 Gets the kzb URL of a project item.
 
string Name [get, set]
 Gets or sets the name of a project item.
 
ProjectItem Parent [get, set]
 Gets or sets the parent of this project item.
 
string Path [get]
 Gets the path to this project item within the project.
 
Project Project [get]
 Gets the project in which this item is located.
 
Type ProjectItemType [get]
 Gets the type of this project item.
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project.
 
object this[Property property] [get, set]
 Gets or sets the value of the specified property on this project item.
 
object this[string propertyName] [get, set]
 Gets or sets the value of the property with the specified name on this project item.
 
string ToolTip [get]
 Gets the tooltip text for this project item in Kanzi Studio.
 
string TypeDisplayName [get]
 Gets the type of a project item.
 
- Properties inherited from PropertyContainer
IEnumerable< PropertyProperties [get]
 Gets the properties in a project item or node component.
 
- Properties inherited from BindingHost
IEnumerable< BindingBindings [get]
 Gets the bindings in a BindingHost.
 

Additional Inherited Members

- Events inherited from ProjectItem
EventHandler< CollectionChangedEventArgs< ProjectItem > > ChildCollectionChanged
 Occurs when the children collection of this project item changes.
 
EventHandler< DeletedEventArgsDeleted
 Occurs after this project item has been deleted.
 
EventHandler< DeletedEventArgsDeleting
 Occurs when this project item is about to be deleted.
 
EventHandler< CollectionChangedEventArgs< ProjectItem > > DescendantChildCollectionChanged
 Occurs when the children collection of this project item or any of its descendants changes.
 
EventHandler< DeletedEventArgsDescendantDeleted
 Occurs after a descendant of this project item has been deleted.
 
EventHandler< DynamicPropertyChangedEventArgsDescendantDynamicPropertyChanged
 Occurs when a dynamic property value changes on this project item or any of its descendants.
 
EventHandler< ParentChangedEventArgsDescendantParentChanged
 Occurs when the parent of this project item or any of its descendants changes.
 
EventHandler< CollectionChangedEventArgs< string > > DescendantPropertyCollectionChanged
 Occurs when a property is added to or removed from this project item or any of its descendants.
 
EventHandler< ProjectItemEventArgsDisposing
 Occurs when this project item is being disposed.
 
EventHandler< DynamicPropertyChangedEventArgsDynamicPropertyChanged
 Occurs when a dynamic property value changes on this project item.
 
EventHandler< ParentChangedEventArgsParentChanged
 Occurs when the parent of this project item changes.
 
EventHandler< PathChangedEventArgsPathChanged
 Occurs when the path of this project item changes.
 
EventHandler< DynamicPropertyChangedEventArgsPreviewDescendantDynamicPropertyChanged
 Occurs before a dynamic property value changes on this project item or any of its descendants.
 
EventHandler< DynamicPropertyChangedEventArgsPreviewDynamicPropertyChanged
 Occurs before a dynamic property value changes on this project item.
 
EventHandler< CollectionChangedEventArgs< string > > PropertyCollectionChanged
 Occurs when a property is added to or removed from this project item.
 
EventHandler< ReplaceEventArgsReplacing
 Occurs when this project item is being replaced.
 
EventHandler ThumbnailChanged
 Occurs when the thumbnail of this project item changes.
 
EventHandler ValidityChanged
 Occurs when the validity state of this project item changes.
 

Detailed Description

Configure triggers.

You can use this interface to:

  • Configure trigger settings. You can set the message handling, routing mode, and message source of a trigger.
  • Create and delete trigger actions. An action is an outcome of a trigger. Kanzi has general actions, such as Set Property and Write Log, and message actions, that you can use to control a specific type of item, such as Go To State, or Navigate To Page.
  • Create and delete trigger conditions. Trigger conditions enable you to set which conditions must be met for the trigger to set off.
See also
NodeComponentHost, TriggerActionItem, TriggerConditionItem

Member Function Documentation

◆ CreateAction()

TriggerActionItem CreateAction ( [NotNull] TriggerActionType actionType)

Creates a trigger action.

Parameters
actionType
Returns
The trigger action.
See also
TriggerActionItem

Examples

To create a Write Log action:

public void Execute(PluginCommandParameter parameter)
{
// Create a Button 2D node named Click in the RootNode node.
var buttonClick = studio.ActiveProject.CreateProjectItem<Button2D>(
"Click",
studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode"));
// Get the first Button: Click trigger in the Click button.
var clickTrigger = buttonClick.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a Write Log action in the Button: Click trigger.
var writeLogAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// In the Write Log action set Log Text to "Button clicked".
writeLogAction.Set(Properties.WriteLogActionLogText, "Button clicked");
}

To create a Set Property action:

// This example creates a button with a Set Property action in the Button: Click trigger.
// When you click the button, the Set Property action sets the value of the Layout Width
// property in the parent node of the button.
public void Execute(PluginCommandParameter parameter)
{
// Create a Button 2D node named Resize in the RootNode node.
var buttonSetWidth = studio.ActiveProject.CreateProjectItem<Button2D>(
"Resize",
studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode"));
// Get the first Button: Click trigger in the Resize button.
var clickTrigger =
buttonSetWidth.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a Set Property action in the Button: Click trigger.
var setPropertyAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.SetPropertyAction"));
// Create a reference to the parent node of the Button 2D node.
ProjectItemReference<ExportedPropertyContainerItem> routingTarget = new NodeReference<Button2D>("..");
// In the Set Property action set the Target Item to the parent node of the Resize button.
// Target Item is the node to which you apply the action.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyTargetItem, routingTarget);
// In the Set Property action set Target Property to Layout Width.
// Target Property is the property to which you apply the new value.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyPropertyType, Properties.NodeWidth);
// In the Set Property action set Target Property Attribute to Whole property.
setPropertyAction.Set(
Properties.MessageArgumentSetPropertyPropertyAttribute,
// In the Set Property action set Value From to Fixed value.
setPropertyAction.Set(Properties.MessageArgumentSetPropertySourceType, EventArgumentValueTypeEnum.FIXED);
// In the Set Property action set Property Value to 500.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyPropertyValue.Name, 500.0f);
}

To create a dispatch message action:

// This example creates a state manager with a state that sets the background color of the RootNode node,
// and a button with a Go To State action in the first Button: Click trigger.
// When you click the button, the background color of the RootNode node changes.
public void Execute(PluginCommandParameter parameter)
{
// Get the State Managers library which stores the state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.ActiveProject.StateManagerLibrary;
// Create a state manager named My State Manager in the State Managers library.
var myStateManager = studio.ActiveProject.CreateProjectItem<StateManager>(
stateManagerLibrary.GenerateUniqueChildName("My State Manager"),
stateManagerLibrary);
// Create a state group named My State Group in the My State Manager state manager.
var myStateGroup = studio.ActiveProject.CreateProjectItem<StateGroup>(
myStateManager.GenerateUniqueChildName("My State Group"),
myStateManager);
// Create a state named My State in the My State Group state group.
var myState = studio.ActiveProject.CreateProjectItem<State>(
myStateGroup.GenerateUniqueChildName("My State"),
myStateGroup);
// Create a state object named RootNode in the My State state.
var myStateObject = studio.ActiveProject.CreateProjectItem<StateObject>(
myState.GenerateUniqueChildName("RootNode"),
myState);
// Get the Brushes library in the Library > Materials and Textures which stores all the Brushes
// in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Create a Color Brush named Blue Brush in the Brushes Library.
var blueBrush =
studio.ActiveProject.CreateBrush(
brushLibrary.GenerateUniqueChildName("Blue Brush"),
brushLibrary,
BrushTypeEnum.COLOR);
// Create a blue color.
var blueColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 255);
// Set the color of the Blue Brush brush to the blue color.
blueBrush.Set(blueBrush.PropertyTypes.ColorBrushColor, blueColor);
// Add and set the Background Brush in the RootNode state object to Blue Brush.
myStateObject.AddProperty(Properties.Node2DBackgroundBrush);
myStateObject.Set(Properties.Node2DBackgroundBrush.Name, blueBrush);
// Get the RootNode node in the Screens/Screen node.
var parentNode = studio.ActiveProject.GetProjectItem("Screens/Screen");
var rootNode = parentNode.GetChild<EmptyNode2D>("RootNode");
// Set the State Manager property of the RootNode node to MyStateManager.
rootNode.Set(Properties.NodeStateManager.Name, myStateManager);
// Create a Button 2D node named "Go Blue" in the RootNode node.
var goButton = studio.ActiveProject.CreateProjectItem<Button2D>(
"Go Blue",
rootNode);
// Create a Text Block 2D node in the Go Blue button.
var buttonLabel = studio.ActiveProject.CreateProjectItem<TextBlock2D>("Label", goButton);
// Set the Text property of the Text Block 2D node to Go Blue.
buttonLabel.Set(Properties.TextConceptText, "Go Blue");
// Get the first Button: Click trigger in the Go Blue button.
var clickTrigger =
goButton.Triggers.First(
trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a trigger action, and set:
// * Trigger Action Type to Dispatch Message Action
// * Message Type to Go To State
var goToStateAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.DispatchMessageAction"));
goToStateAction.DispatchMessageActionMessageType = studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.StateManager.GoToState");
// In the Go To State action set Target Item to the RootNode node.
goToStateAction.RoutingTarget = new NodeReference<EmptyNode2D>(rootNode);
// In the Go To State action set State to My State.
goToStateAction.Set(Properties.MessageArgumentStateManagerState.Name, "My State");
}

To create a dispatch message action and set the target item using a relative path:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootNode node in the Screens/Screen node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Page Host node named RootPage in the RootNode node.
var rootPage = studio.ActiveProject.CreateProjectItem<PageHost>(rootNode.GenerateUniqueChildName("RootPage"), rootNode);
// Create a Page node named Page1 in the RootPage node.
var page1 = studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Page1"), rootPage);
// Set the Default Subpage property of the RootPage node to the Page1 node.
rootPage.Set(Properties.PageHostDefaultSubPage.Name, "Page1");
// Create a Page node named Page2 in the RootPage node.
studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Page2"), rootPage);
// Create a Button 2D node named "Next" in the RootPage node.
var nextButton = studio.ActiveProject.CreateProjectItem<Button2D>("Next", rootPage);
// Create a Text Block 2D node named "Next page" in the Next button.
var buttonLabel = studio.ActiveProject.CreateProjectItem<TextBlock2D>("Next page", nextButton);
// In the Text Block 2D node set the Text property to Next page.
buttonLabel.Set(Properties.TextConceptText, "Next page");
// Get the first Button: Click trigger in the Next button.
var clickTrigger =
nextButton.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a trigger action, and set:
// * Trigger Action Type to Dispatch Message Action
// * Message Type to Navigate To Page
var navigateToPageAction = clickTrigger.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 Page2 node.
navigateToPageAction.RoutingTarget = new NodeReference<Page>("../Page2");
}

◆ CreateCondition() [1/2]

TriggerConditionItem CreateCondition ( )

Creates a trigger condition.

Trigger conditions enable you to set which conditions must be met for the trigger to set off.

Returns
The trigger condition.
See also
TriggerConditionItem

Examples

To create an empty trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Button 2D node in the RootNode node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootNode.GenerateUniqueChildName("Button 2D"), rootNode);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
}

◆ CreateCondition() [2/2]

TriggerConditionItem CreateCondition ( [NotNull] TriggerConditionItem toClone)

Creates a trigger condition by cloning an existing trigger condition.

Parameters
toCloneThe trigger condition that you want to clone to create a new trigger condition.
Returns
The trigger condition.
See also
TriggerConditionItem

Examples

To create a trigger condition by cloning an existing trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Button 2D node in the RootNode node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootNode.GenerateUniqueChildName("Button 2D"), rootNode);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Create a trigger condition by cloning the empty trigger condition that you created.
clickTrigger.CreateCondition(triggerCondition);
}

◆ DeleteAction()

bool DeleteAction ( [NotNull] TriggerActionItem action)

Deletes a trigger action.

Parameters
actionThe trigger action that you want to delete.
Returns
When it deletes the action successfully, true, otherwise false.

Examples

To delete a trigger action:

// To delete a trigger action you first have to get the trigger and the action, and then use the DeleteAction
// function to delete the action.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Button 2D node in the RootNode node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootNode.GenerateUniqueChildName("Button 2D"), rootNode);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a Write Log action.
var writeLogAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// Use the DeleteAction function to delete the Write Log action.
clickTrigger.DeleteAction(writeLogAction);
}

◆ DeleteCondition()

bool DeleteCondition ( [NotNull] TriggerConditionItem condition)

Deletes a trigger condition.

Parameters
conditionThe trigger condition that you want to delete.
Returns
When it deletes the condition successfully, true, otherwise false.

Examples

To delete a trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// Create a Button 2D node in the RootNode node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootNode.GenerateUniqueChildName("Button 2D"), rootNode);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Use the DeleteCondition function to delete the trigger condition.
clickTrigger.DeleteCondition(triggerCondition);
}

Property Documentation

◆ Actions

IEnumerable<TriggerActionItem> Actions
get

Gets the actions in a trigger.

◆ Conditions

IEnumerable<TriggerConditionItem> Conditions
get

Gets the conditions in a trigger.

◆ IsMessageTrigger

bool IsMessageTrigger
get

Gets whether the trigger is a message trigger.

◆ MessageSource

Node MessageSource
getset

Gets or sets the target item from which to intercept messages.

Use either MessageSource or RelativeMessageSource to set the specific target item from which to intercept messages.

Examples

To create a trigger and set the target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootNode node in the Screens/Screen node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<EmptyNode2D>("RootNode");
// Create a Toggle Button Group 2D node in the RootNode node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootNode.GenerateUniqueChildName("Toggle Button Group 2D"),
rootNode);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
var toggleButton1 = studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
var toggleButton2 = studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.MessageSource = toggleButton1;
}

◆ PropertyTypes

Implements NodeComponent.

◆ RelativeMessageSource

NodeReference<Node> RelativeMessageSource
getset

Gets or sets the relative path to the target item from which to intercept messages:

  • Reference to the target item to intercept messages from a specific target item
  • Null to intercept messages from all sources

Use either RelativeMessageSource or MessageSource to set the specific target item from which to intercept messages.

Examples

To create a trigger and set the relative target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootNode node in the Screens/Screen node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<EmptyNode2D>("RootNode");
// Create a Toggle Button Group 2D node in the RootNode node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootNode.GenerateUniqueChildName("Toggle Button Group 2D"),
rootNode);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// Create a reference to the Toggle Button 1 node.
NodeReference<Node> relativeMessageSource = new NodeReference<Node>("Stack Layout 2D/Toggle Button 1");
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.RelativeMessageSource = relativeMessageSource;
}

To create a trigger and set it to intercept messages from all sources:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootNode node in the Screens/Screen node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<EmptyNode2D>("RootNode");
// Create a Toggle Button Group 2D node in the RootNode node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootNode.GenerateUniqueChildName("Toggle Button Group 2D"),
rootNode);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// To set the Toggle Button Group: Toggled trigger to intercept messages from all sources,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to <No Item>.
toggledTrigger.RelativeMessageSource = null;
}

◆ RoutingMode

MessageRoutingModeEnum RoutingMode
getset

Gets or sets the message routing mode:

  • TUNNELING to intercept only tunneling messages
  • BUBBLING to intercept only bubbling messages
  • TUNNELING_AND_BUBBLING to intercept tunneling and bubbling messages

◆ SetHandled

bool SetHandled
getset

Gets or sets the message handling mode:

  • TRUE to intercept and handle the message.The message stops here, and does not continue neither bubbling nor tunneling in the project tree.
  • FALSE to intercept the message, but let the message continue bubbling or tunneling in the project tree.

◆ TriggerMessageType

MessageType TriggerMessageType
get

Gets the Trigger Message Type.

See also
Project.TriggerActionTypeLibrary