I added:
FormItemMessagesBuilder - recieves properties that user wants to have form messages and creates view-model object with proper schema.
FormItemMessages - View-model of ItemMessages object, contains all methods that end user should use to set, get, and clear messages.
FormItemMessage - class that represents message object, which is returned when getting a message.
MessageContainer - Container that contains properties schema representations and allows to perform operations on them.
How to use:
Add container object to the view-model json: "ItemMessages": {}
In view-model code behind:
static FormItemPage()
{
DefaultTemplate.ItemMessages.InstanceType = typeof(ItemMessages);
}
public void Init()
{
this.ItemMessages = new FormItemMessagesBuilder().ForProperty(nameof(this.Word)).Build();
}
Start using it!
void Handle(Input.Word action)
{
if (action.Value.Length == 0)
{
this.ItemMessages.SetMessage(nameof(this.Word), "Word cannot be empty!", MessageType.Invalid);
}
}
I added: FormItemMessagesBuilder - recieves properties that user wants to have form messages and creates view-model object with proper schema. FormItemMessages - View-model of ItemMessages object, contains all methods that end user should use to set, get, and clear messages. FormItemMessage - class that represents message object, which is returned when getting a message. MessageContainer - Container that contains properties schema representations and allows to perform operations on them.
How to use:
"ItemMessages": {}
In view-model code behind: