hope this helps:
class ListItemDataEventArgs : EventArgs
{
public ushort Index;
public string Data;
ListDataEventArgs(int index, string data)
{
Index = Convert.ToUInt16(index + 1); //from 0 based index, to 1 based index in SIMPL+
Data = data;
}
ListItemDataEventArgs()
{
//simpl+ compliance
}
}
class ListWrapper
{
List DataHolder;
public EventHandler OnListItemChange;
UpdateSimpl()
{
for(int i = 0; i< DataHolder.Count; i++)
{
OnListItemChange.Invoke(this, new ListDataEventArgs(i,DataHolder[i]));
}
}
FetchData()
{
...
UpdateSimpl();
}
}
/ SIMPL+ Side */
#DEFINE_CONSTANT MAX_ITEMS 32
STRING_OUTPUT
data[MAX_ITEMS];
ListWrapper myData; //tie to C# class
//Event handler for the myData.OnListItemChange
EventHandler ListItemChangeHandler(ListWrapper caller, ListItemDataEventArgs args)
{
if (args.Index > 0 && args.Index<= MAX_ITEMS)
data[args.Index] = args.Data;
}
FUNCTION Main()
{
RegisterEvent(myData,OnListItemChange,ListItemChangeHandler);
WaitForInitializationComplete();
}