2 using System.Collections.Generic;
3 using System.Reflection;
5 using Tizen.NUI.BaseComponents;
6 using Tizen.NUI.Binding;
7 using Tizen.NUI.Binding.Internals;
9 namespace Tizen.NUI.EXaml
11 internal class CreateInstance : Operation
13 public CreateInstance(int typeIndex, List<object> paramList = null)
15 this.typeIndex = typeIndex;
16 this.paramList = paramList;
21 if (0 == LoadEXaml.GatheredInstances.Count && null != Root)
23 LoadEXaml.GatheredInstances.Add(Root);
27 var type = GatherType.GatheredTypes[typeIndex];
29 if (null == paramList)
31 LoadEXaml.GatheredInstances.Add(Activator.CreateInstance(type));
35 for (int i = 0; i < paramList.Count; i++)
37 if (paramList[i] is Instance)
39 paramList[i] = LoadEXaml.GatheredInstances[(paramList[i] as Instance).Index];
42 LoadEXaml.GatheredInstances.Add(Activator.CreateInstance(type, paramList.ToArray()));
46 if (1 == LoadEXaml.GatheredInstances.Count)
48 var rootObject = LoadEXaml.GatheredInstances[0] as BindableObject;
49 if (null != rootObject)
51 rootObject.IsCreateByXaml = true;
52 NameScope nameScope = new NameScope();
53 NameScope.SetNameScope(rootObject, nameScope);
58 private int typeIndex;
60 internal static object Root;
62 private List<object> paramList;