support returning multiple instances from elements built by Build Element Methods
This commit is contained in:
parent
1cdfb21bdd
commit
7beeffd9ad
@ -172,8 +172,21 @@ public class Element : Widget
|
||||
|
||||
InstanceHandle workSet = OMS.Execute(context, loopExecutable);
|
||||
object? obj = context.GetWorkData(workSet);
|
||||
if (obj is IEnumerable<InstanceHandle> list)
|
||||
|
||||
IEnumerable<InstanceHandle> list;
|
||||
if (obj is IEnumerable<InstanceHandle> list2)
|
||||
{
|
||||
list = list2;
|
||||
}
|
||||
else if (obj is InstanceHandle)
|
||||
{
|
||||
list = new InstanceHandle[] { (InstanceHandle)obj };
|
||||
}
|
||||
else
|
||||
{
|
||||
list = new InstanceHandle[0];
|
||||
}
|
||||
|
||||
JsonArray ary = new JsonArray();
|
||||
foreach (InstanceHandle ih in list)
|
||||
{
|
||||
@ -219,7 +232,4 @@ public class Element : Widget
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user