Hello, This is going to be a relatively long post.
I have been trying to accomplish something specific when creating assets, and by this point I am not sure if either I am doing it incorrectly, or simply it isn’t a feature in the first place. I will explain:
Currently, when creating a trigger, when defining actions to take place following the trigger, you are able to bind properties that have been returned from said trigger. We can see that in the UI windows in FIG 1. and 2.
Trigger Binding
FIG 1.
Given that the trigger custom_asset_triggered just fired, if that asset returned something using the function syntax:
custom_asset_triggered(this, SomeValue);
Then we would be able to access SomeValue as a value to be bound to some other asset.
Single/Multiple Value Binding
FIG 2.
Here is the UI window displaying the values available to be bound that were returned from the
trigger above.
Currently I know for a fact how to return a single value on this trigger. In this case, I would just need to make sure that in the IFD file that the event ‘custom_asset_triggered’ has the appropriate parameter ‘SomeValue’ defined within it.
My issue begins when it comes to returning multiple values to this trigger. In a perfect world, I would like to be able to achieve something like I have shown in the following image.
Classy Trigger
FIG 3.
Here rather than returning a single value, I want to be able to return an object that can potentially contain other nested class objects as well. I am not really sure if this is even capable in Intuiface as I haven’t seen nested data like this in this part of the UI, though I do know that nested data can be displayed as readonly asset parameters in the typical asset panel.
Every time I attempt this, I get some IFD issue, or just nothing returns. Here is my main attempt generalized:
C# code
class CustomAsset : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
}
class SomeObject{
int A;
int B;
NestedObject C;
}
class NestedObject{
int X;
int Y;
}
// Create a custom helper so that our trigger has something to return rather than 'null'
public delegate void CustomHelper(object sender, SomeObject e);
public event CustomHelper custom_asset_triggered;
public void DoSomeAction(object sender, EventArgs e){
NestedObject SomeValue = new NestedObject {
A = 0;
B = 3;
C = {
X = 5;
Y = 8;
}
}
custom_asset_triggered(this, SomeValue);
}
}
IFD File
Here is the IFD file as it would be generated by intuiface. Below that I list the edits that I make to the IFD file to try and get this working.
Base File
{
"kind": "discovery#restDescription",
"discoveryVersion": "v1",
"id": "CustomAsset",
"name": "CustomAsset",
"version": "1.0",
"protocol": "dll",
"baseUrl": null,
"basePath": "CustomAsset",
"auth": {},
"dependencies": [
"CustomAsset.dll"
],
"schemas": {
"SomeObject": {
"id": "SomeObject",
"type": "object",
"properties": {
"A": {
"title": "A",
"type": "integer",
"description": "A"
},
"B": {
"title": "B",
"type": "integer",
"description": "B"
},
"C": {
"$ref": "NestedObject"
}
}
},
"NestedObject": {
"id": "NestedObject",
"type": "object",
"properties": {
"X": {
"title": "X",
"type": "integer",
"description": "X"
},
"Y": {
"title": "Y",
"type": "integer",
"description": "Y"
}
}
},
"CustomAsset": {
"id": "CustomAsset",
"type": "object"
}
},
"resources": {
"SomeObject": {
"title": "SomeObject",
"isInterfaceAsset": true
},
"NestedObject": {
"title": "NestedObject",
"isInterfaceAsset": true
},
"CustomAsset": {
"title": "CustomAsset",
"isInterfaceAsset": true,
"methods": {
"DoSomeAction": {
"title": "DoSomeAction",
"description": "DoSomeAction",
"response": {
"type": "null"
}
}
},
"events": {
"WorkFinished": {
"id": "WorkFinished"
}
}
}
}
}
File Edits
First, I tried just simply updating the CustomAsset WorkFinished event entry to include a reference parameter to our desired object to be returned:
"events": {
"WorkFinished": {
"id": "WorkFinished",
"parameters": {
"SomeValue": {
"$ref": "SomeObject"
}
}
}
}
This didn’t work, so Instead I tried instead enumerating parameters for the fields within the object, and this didn’t work either.:
"events": {
"WorkFinished": {
"id": "WorkFinished"
"parameters": {
"A": {
"title": "A",
"type": "integer"
},
"B": {
"title": "B",
"type": "integer"
},
"C": {
"X": {
"title": "X",
"type": "integer"
},
"Y": {
"title": "Y",
"type": "integer"
}
}
}
}
}
I am currently forced to assume 1 of 4 possibilities.
- I am doing the code incorrectly
- I am doing the IFD incorrectly
- Both 1 and 2
- This simply isn’t supported by IntuiFace yet.
Does anyone else know how I might go about achieving the desired output from Fig 3.?