I'm struggling to get a consistent result returning a list of custom structures to a feature page from my plugin.
I put this code together to try to demonstrate the issue:
When I call the function from an html feature page with:
On some pages I get some of the elements, on others I get none of the elements and in some cases, the page causes HomeSeer to hang and I have to kill the plugin's .exe.
What am I missing? Is there a recommended way to return a custom list to a feature page?
-David
I put this code together to try to demonstrate the issue:
Code:
<Serializable()> Public Structure TestStructure Dim element1 As String Dim element2 As String Dim element3 As String Dim element4 As String Dim element5 As String End Structure Public Function ext_TestStructure(ByVal NumElements As String) As List(Of TestStructure) Console.WriteLine("ext_TestStructure...") Dim RetList As New List(Of TestStructure) For n As Integer = 1 To CInt(NumElements) Dim TestVar As New TestStructure TestVar.element1 = "Element1" & n.ToString & ")" TestVar.element2 = "Element2" & n.ToString & ")" TestVar.element3 = "Element3" & n.ToString & ")" TestVar.element4 = "Element4(" & n.ToString & ")" TestVar.element5 = "Element5(" & n.ToString & ")" RetList.Add(TestVar) Next Console.WriteLine("ext_TestStructure... returning " & RetList.Count.ToString & " items") Return RetList End Function
Code:
[B]{{[/B]list=plugin_function 'drhsIR' 'ext_TestStructure' ['5'][B]}}[/B] [B]{{[/B][B]for[/B] item in list[B]}}[/B] [B]{{[/B]item.element1[B]}}[/B] [B]{{[/B]item.element2[B]}}[/B] [B]{{[/B]item.element3[B]}}[/B] [B]{{[/B]item.element4[B]}}[/B] [B]{{[/B]item.element5[B]}}[/B] [B]{{[/B]end[B]}}[/B]
What am I missing? Is there a recommended way to return a custom list to a feature page?
-David
Comment