--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal interface Action
+ {
+ void Init();
+
+ void OnActive();
+
+ Action DealChar(char c);
+ }
+
+ internal class Instance
+ {
+ internal Instance(int index)
+ {
+ Index = index;
+ }
+ internal int Index
+ {
+ get;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddEventAction : Action
+ {
+ public AddEventAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '#':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int elementIndex = (childOp.ValueList[1] as Instance).Index;
+ int propertyIndex = (int)childOp.ValueList[2];
+ int value = (int)childOp.ValueList[3];
+ LoadEXaml.Operations.Add(new AddEvent(instanceIndex, elementIndex, propertyIndex, value));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddExistInstanceAction : Action
+ {
+ internal AddExistInstanceAction(Action parent)
+ {
+ this.parent = parent;
+ }
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '@':
+ parent?.OnActive();
+ return parent;
+
+ case '(':
+ getValueListOp = new GetValueListAction(')', this);
+ return getValueListOp;
+
+ case 'o':
+ case 'q':
+ sign = c;
+ break;
+ }
+
+ return this;
+ }
+
+ public void Init()
+ {
+ }
+
+ public void OnActive()
+ {
+ if (null != getValueListOp)
+ {
+ object value0 = getValueListOp.ValueList[0];
+ int index = (value0 is Instance) ? (value0 as Instance).Index : (int)value0;
+ string value = getValueListOp.ValueList[1] as string;
+
+ if ('q' == sign)
+ {
+ LoadEXaml.Operations.Add(new GatherConvertedValue(index, value));
+ }
+ else if ('o' == sign)
+ {
+ LoadEXaml.Operations.Add(new GatherEnumValue(index, value));
+ }
+
+ getValueListOp = null;
+ }
+ }
+
+ private char sign;
+ private GetValueListAction getValueListOp;
+
+ internal static object Root
+ {
+ get;
+ set;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddToResourceDictionaryAction : Action
+ {
+ public AddToResourceDictionaryAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '*':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ string key = childOp.ValueList[1] as string;
+ var value = childOp.ValueList[2];
+ LoadEXaml.Operations.Add(new AddToResourceDictionary(instanceIndex, key, value));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class CallAddMethodAction : Action
+ {
+ public CallAddMethodAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '^':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int parentIndex = (childOp.ValueList[0] as Instance).Index;
+ int childIndex = (childOp.ValueList[1] as Instance).Index;
+ int methodIndex = (int)childOp.ValueList[2];
+
+ LoadEXaml.Operations.Add(new CallAddMethod(parentIndex, childIndex, methodIndex));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class CreateObjectAction : Action
+ {
+ internal CreateObjectAction(Action parent)
+ {
+ this.parent = parent;
+ }
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '}':
+ parent?.OnActive();
+ return parent;
+
+ case '(':
+ getParamListOp = new GetValueListAction(')', this);
+ return getParamListOp;
+
+ default:
+ getTypeIndexOp = new GetValueAction(c, this);
+ return getTypeIndexOp;
+ }
+
+ return this;
+ }
+
+ public void Init()
+ {
+ }
+
+ public void OnActive()
+ {
+ if (null != getTypeIndexOp)
+ {
+ int typeIndex = (int)getTypeIndexOp.Value;
+ if (null == getParamListOp)
+ {
+ LoadEXaml.Operations.Add(new CreateInstance(typeIndex));
+ }
+ else
+ {
+ LoadEXaml.Operations.Add(new CreateInstance(typeIndex, getParamListOp.ValueList));
+ }
+ getParamListOp = null;
+ }
+
+ getTypeIndexOp = null;
+ }
+
+ private GetValueAction getTypeIndexOp;
+ private GetValueListAction getParamListOp;
+
+ internal static object Root
+ {
+ get
+ {
+ return CreateInstance.Root;
+ }
+ set
+ {
+ CreateInstance.Root = value;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherBindablePropertiesAction : Action
+ {
+ public GatherBindablePropertiesAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ int typeIndex = int.Parse(childOp.ValueList[0] as string);
+ string propertyName = childOp.ValueList[1] as string;
+
+ LoadEXaml.Operations.Add(new GatherBindableProperties(typeIndex, propertyName));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GetValueAction : Action
+ {
+ public GetValueAction(char sign, Action parent)
+ {
+ this.sign = sign;
+ this.parent = parent;
+ }
+ private char sign;
+ private Action parent;
+
+ private delegate object GetValueByString(string value);
+
+ private static GetValueByString[] getValueByStrings = null;
+ private static GetValueByString[] GetValueByStrings
+ {
+ get
+ {
+ if (null == getValueByStrings)
+ {
+ getValueByStrings = new GetValueByString['p' - 'a' + 2];
+
+ getValueByStrings[0] = (string value) =>
+ {
+ return value;
+ };
+
+ //'a' -> 1 Ojbect
+ getValueByStrings[1] = (string value) =>
+ {
+ int index = int.Parse(value);
+ return new Instance(index);
+ };
+
+ //b SByte
+ getValueByStrings[2] = (string value) =>
+ {
+ return SByte.Parse(value);
+ };
+
+ //c Int16
+ getValueByStrings[3] = (string value) =>
+ {
+ return Int16.Parse(value);
+ };
+
+ //d Int32
+ getValueByStrings[4] = (string value) =>
+ {
+ return Int32.Parse(value);
+ };
+
+ //e Int64
+ getValueByStrings[5] = (string value) =>
+ {
+ return Int64.Parse(value);
+ };
+
+ //f Byte
+ getValueByStrings[6] = (string value) =>
+ {
+ return Byte.Parse(value);
+ };
+
+ //g UInt16
+ getValueByStrings[7] = (string value) =>
+ {
+ return UInt16.Parse(value);
+ };
+
+ //h UInt32
+ getValueByStrings[8] = (string value) =>
+ {
+ return UInt32.Parse(value);
+ };
+
+ //i UInt64
+ getValueByStrings[9] = (string value) =>
+ {
+ return UInt64.Parse(value);
+ };
+
+ //j Single
+ getValueByStrings[10] = (string value) =>
+ {
+ return Single.Parse(value);
+ };
+
+ //k Double
+ getValueByStrings[11] = (string value) =>
+ {
+ return Double.Parse(value);
+ };
+
+ //l Boolean
+ getValueByStrings[12] = (string value) =>
+ {
+ return Boolean.Parse(value);
+ };
+
+ //m TimeSpan
+ getValueByStrings[13] = (string value) =>
+ {
+ return TimeSpan.Parse(value);
+ };
+
+ //n decimal
+ getValueByStrings[14] = (string value) =>
+ {
+ return decimal.Parse(value);
+ };
+
+ //o enum
+ getValueByStrings[15] = (string value) =>
+ {
+ //Should be deal prev
+ return null;
+ };
+ }
+
+ return getValueByStrings;
+ }
+ }
+
+ public Action DealChar(char c)
+ {
+ if (c == sign)
+ {
+ switch (sign)
+ {
+ case '\"':
+ Value = GetValueByStrings[0](valueString);
+ break;
+
+ case 'z':
+ Value = null;
+ break;
+
+ default:
+ Value = GetValueByStrings[c - 'a' + 1](valueString);
+ break;
+ }
+
+ parent?.OnActive();
+ return parent;
+ }
+
+ if ('\"' != sign)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ return this;
+
+ case '(':
+ getValueList = new GetValueListAction(')', this);
+ return getValueList;
+ }
+ }
+
+ valueString += c;
+
+ return this;
+ }
+
+ private string valueString;
+
+ private GetValueListAction getValueList;
+
+ public object Value
+ {
+ get;
+ private set;
+ }
+
+ public void Init()
+ {
+ valueString = "";
+ }
+
+ public void OnActive()
+ {
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GetValueListAction : Action
+ {
+ public GetValueListAction(char sign, Action parent)
+ {
+ this.sign = sign;
+ this.parent = parent;
+ }
+ private char sign;
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ if (c == sign)
+ {
+ parent?.OnActive();
+ return parent;
+ }
+
+ if ('\"' != sign)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ return this;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ default:
+ childOp = new GetValueAction(c, this);
+ return childOp;
+ }
+ }
+
+ return this;
+ }
+
+ internal List<object> ValueList
+ {
+ get;
+ } = new List<object>();
+
+ private Action childOp;
+
+ public void Init()
+ {
+ ValueList.Clear();
+ }
+
+ public void OnActive()
+ {
+ GetValueAction getValueAction;
+ GetValueListAction getValueListAction;
+
+ if (null != (getValueAction = (childOp as GetValueAction)))
+ {
+ ValueList.Add(getValueAction.Value);
+ }
+ else if (null != (getValueListAction = (childOp as GetValueListAction)))
+ {
+ ValueList.Add(getValueListAction.ValueList);
+ }
+
+ childOp = null;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class RegisterXNameAction : Action
+ {
+ public RegisterXNameAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '&':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ object instance = childOp.ValueList[0];
+ string xName = childOp.ValueList[1] as string;
+
+ LoadEXaml.Operations.Add(new RegisterXName(instance, xName));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetBindalbePropertyAction : Action
+ {
+ public SetBindalbePropertyAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '!':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int bindalbePropertyIndex = (int)childOp.ValueList[1];
+ var value = childOp.ValueList[2];
+ LoadEXaml.Operations.Add(new SetBindalbeProperty(instanceIndex, bindalbePropertyIndex, value));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetBindingAction : Action
+ {
+ public SetBindingAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '%':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ var propertyIndex = (int)childOp.ValueList[1];
+ int valueIndex = (childOp.ValueList[2] as Instance).Index;
+
+ LoadEXaml.Operations.Add(new SetBinding(instanceIndex, propertyIndex, valueIndex));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetDynamicResourceAction : Action
+ {
+ public SetDynamicResourceAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '$':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int propertyIndex = (int)childOp.ValueList[1];
+ string key = childOp.ValueList[2] as string;
+
+ LoadEXaml.Operations.Add(new SetDynamicResource(instanceIndex, propertyIndex, key));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetPropertyAction : Action
+ {
+ public SetPropertyAction(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case ']':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ if (null != childOp)
+ {
+ int instanceIndex = (childOp.ValueList[0] as Instance).Index;
+ int propertyIndex = (int)childOp.ValueList[1];
+ var value = childOp.ValueList[2];
+ LoadEXaml.Operations.Add(new SetProperty(instanceIndex, propertyIndex, value));
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherAssembliesBlock : Action
+ {
+ public GatherAssembliesBlock(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '\"':
+ childOp = new GetValueAction(c, this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ var readedAssemblyName = childOp.Value as string;
+ LoadEXaml.Operations.Add(new GatherAssembly(readedAssemblyName));
+ childOp = null;
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherEventsBlock : Action
+ {
+ public GatherEventsBlock(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ int typeIndex = int.Parse(childOp.ValueList[0] as string);
+ string eventName = childOp.ValueList[1] as string;
+
+ LoadEXaml.Operations.Add(new GatherEvent(typeIndex, eventName));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherMethodsBlock : Action
+ {
+ public GatherMethodsBlock(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ int typeIndex = int.Parse(childOp.ValueList[0] as string);
+ string name = childOp.ValueList[1] as string;
+ LoadEXaml.Operations.Add(new GatherMethod(typeIndex, name));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherPropertiesBlock : Action
+ {
+ public GatherPropertiesBlock(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ int typeIndex = int.Parse(childOp.ValueList[0] as string);
+ string propertyName = childOp.ValueList[1] as string;
+
+ LoadEXaml.Operations.Add(new GatherProperty(typeIndex, propertyName));
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherTypesBlock : Action
+ {
+ public GatherTypesBlock(Action parent)
+ {
+ this.parent = parent;
+ }
+
+ private Action parent;
+
+ public Action DealChar(char c)
+ {
+ switch (c)
+ {
+ case ' ':
+ case '\n':
+ case '\r':
+ break;
+
+ case '(':
+ childOp = new GetValueListAction(')', this);
+ return childOp;
+
+ case '>':
+ parent?.OnActive();
+ return parent;
+ }
+
+ return this;
+ }
+
+ private GetValueListAction childOp;
+
+ public void Init()
+ {
+ childOp = null;
+ }
+
+ public void OnActive()
+ {
+ LoadEXaml.Operations.Add(GatherType(childOp.ValueList));
+ childOp = null;
+ }
+
+ private GatherType GatherType(List<object> valueList)
+ {
+ int assemblyIndex = int.Parse(valueList[0] as string);
+ string typeName = valueList[valueList.Count - 1] as string;
+
+ if (valueList.Count > 2)
+ {
+ List<int> genericTypeIndexs = new List<int>();
+ var genericTypeIndexList = valueList[1] as List<object>;
+ foreach (var index in genericTypeIndexList)
+ {
+ genericTypeIndexs.Add((int)index);
+ }
+
+ return new GatherType(assemblyIndex, typeName, genericTypeIndexs);
+ }
+ else
+ {
+ return new GatherType(assemblyIndex, typeName);
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Tizen.NUI.EXaml
+{
+ internal static class LoadEXaml
+ {
+ internal static void Load(object view, string xaml)
+ {
+ CreateObjectAction.Root = view;
+
+ int index = 0;
+
+ var createObject = new CreateObjectAction(null);
+ var addExistInstance = new AddExistInstanceAction(null);
+ var registerXName = new RegisterXNameAction(null);
+ var setProperty = new SetPropertyAction(null);
+ var addEvent = new AddEventAction(null);
+ var setBindalbeProperty = new SetBindalbePropertyAction(null);
+ var addObject = new CallAddMethodAction(null);
+ var setDynamicResourceAction = new SetDynamicResourceAction(null);
+ var addToResourceDictionaryAction = new AddToResourceDictionaryAction(null);
+ var setBindingAction = new SetBindingAction(null);
+
+ foreach (char c in xaml)
+ {
+ //Console.Write(c);
+ if (null == currentOp)
+ {
+ switch (c)
+ {
+ case '<':
+ if (0 == index)
+ {
+ currentOp = new GatherAssembliesBlock(null);
+ currentOp.Init();
+ index++;
+ }
+ else if (1 == index)
+ {
+ currentOp = new GatherTypesBlock(null);
+ currentOp.Init();
+ index++;
+ }
+ else if (2 == index)
+ {
+ currentOp = new GatherPropertiesBlock(null);
+ currentOp.Init();
+ index++;
+ }
+ else if (3 == index)
+ {
+ currentOp = new GatherEventsBlock(null);
+ currentOp.Init();
+ index++;
+ }
+ else if (4 == index)
+ {
+ currentOp = new GatherMethodsBlock(null);
+ currentOp.Init();
+ index++;
+ }
+ else if (5 == index)
+ {
+ currentOp = new GatherBindablePropertiesAction(null);
+ currentOp.Init();
+ index++;
+ }
+ break;
+
+ case '{':
+ currentOp = createObject;
+ currentOp.Init();
+ break;
+
+ case '@':
+ currentOp = addExistInstance;
+ currentOp.Init();
+ break;
+
+ case '&':
+ currentOp = registerXName;
+ currentOp.Init();
+ break;
+
+ case '[':
+ currentOp = setProperty;
+ currentOp.Init();
+ break;
+
+ case '#':
+ currentOp = addEvent;
+ currentOp.Init();
+ break;
+
+ case '!':
+ currentOp = setBindalbeProperty;
+ currentOp.Init();
+ break;
+
+ case '$':
+ currentOp = setDynamicResourceAction;
+ currentOp.Init();
+ break;
+
+ case '^':
+ currentOp = addObject;
+ currentOp.Init();
+ break;
+
+ case '*':
+ currentOp = addToResourceDictionaryAction;
+ currentOp.Init();
+ break;
+
+ case '%':
+ currentOp = setBindingAction;
+ currentOp.Init();
+ break;
+ }
+ }
+ else
+ {
+ currentOp = currentOp.DealChar(c);
+ }
+ }
+
+ foreach (var op in Operations)
+ {
+ op.Do();
+ }
+ }
+
+ internal static List<object> GatheredInstances
+ {
+ get;
+ } = new List<object>();
+
+ internal static List<Operation> Operations
+ {
+ get;
+ } = new List<Operation>();
+
+ private static Action currentOp = null;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddEvent : Operation
+ {
+ public AddEvent(int instanceIndex, int elementIndex, int eventIndex, int valueIndex)
+ {
+ this.instanceIndex = instanceIndex;
+ this.elementIndex = elementIndex;
+ this.eventIndex = eventIndex;
+ this.valueIndex = valueIndex;
+ }
+
+ public void Do()
+ {
+ object instance = LoadEXaml.GatheredInstances[instanceIndex];
+ object element = LoadEXaml.GatheredInstances[elementIndex];
+ var eventInfo = GatherEvent.GatheredEvents[eventIndex];
+ try
+ {
+ var methodInfo = GatherMethod.GatheredMethods[valueIndex];
+ eventInfo.AddEventHandler(instance, methodInfo.CreateDelegate(eventInfo.EventHandlerType, element));
+ }
+ catch (ArgumentException ae)
+ {
+ Tizen.Log.Fatal("EXaml", ae.ToString());
+ }
+ }
+
+ private int instanceIndex;
+ private int elementIndex;
+ private int eventIndex;
+ private int valueIndex;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddToResourceDictionary : Operation
+ {
+ internal AddToResourceDictionary(int instanceIndex, string key, object value)
+ {
+ this.instanceIndex = instanceIndex;
+ this.key = key;
+ this.value = value;
+ }
+
+ public void Do()
+ {
+ var instance = LoadEXaml.GatheredInstances[instanceIndex] as ResourceDictionary;
+ var realValue = (value is Instance) ? LoadEXaml.GatheredInstances[(value as Instance).Index] : value;
+
+ instance.Add(key, realValue);
+ }
+
+ private int instanceIndex;
+ private string key;
+ private object value;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class CallAddMethod : Operation
+ {
+ public CallAddMethod(int parentIndex, int childIndex, int methodIndex)
+ {
+ this.parentIndex = parentIndex;
+ this.childIndex = childIndex;
+ this.methodIndex = methodIndex;
+ }
+
+ public void Do()
+ {
+ object parent = LoadEXaml.GatheredInstances[parentIndex];
+ object child = LoadEXaml.GatheredInstances[childIndex];
+ var method = GatherMethod.GatheredMethods[methodIndex];
+
+ method.Invoke(parent, new object[] { child });
+ }
+
+ private int parentIndex;
+ private int childIndex;
+ private int methodIndex;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class CreateInstance : Operation
+ {
+ public CreateInstance(int typeIndex, List<object> paramList = null)
+ {
+ this.typeIndex = typeIndex;
+ this.paramList = paramList;
+ }
+
+ public void Do()
+ {
+ if (0 == LoadEXaml.GatheredInstances.Count && null != Root)
+ {
+ LoadEXaml.GatheredInstances.Add(Root);
+ }
+ else
+ {
+ var type = GatherType.GatheredTypes[typeIndex];
+
+ if (null == paramList)
+ {
+ LoadEXaml.GatheredInstances.Add(Activator.CreateInstance(type));
+ }
+ else
+ {
+ for (int i = 0; i < paramList.Count; i++)
+ {
+ if (paramList[i] is Instance)
+ {
+ paramList[i] = LoadEXaml.GatheredInstances[(paramList[i] as Instance).Index];
+ }
+ }
+ LoadEXaml.GatheredInstances.Add(Activator.CreateInstance(type, paramList.ToArray()));
+ }
+ }
+
+ if (1 == LoadEXaml.GatheredInstances.Count)
+ {
+ var rootObject = LoadEXaml.GatheredInstances[0] as BindableObject;
+ if (null != rootObject)
+ {
+ rootObject.IsCreateByXaml = true;
+ NameScope nameScope = new NameScope();
+ NameScope.SetNameScope(rootObject, nameScope);
+ }
+ }
+ }
+
+ private int typeIndex;
+
+ internal static object Root;
+
+ private List<object> paramList;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherAssembly : Operation
+ {
+ public GatherAssembly(string assemblyName)
+ {
+ this.assemblyName = assemblyName;
+ }
+
+ public void Do()
+ {
+ Assembly assembly = null;
+ foreach (var name in AssemblyNameList)
+ {
+ if (name.FullName.StartsWith(assemblyName))
+ {
+ assembly = Assembly.Load(name);
+ GatheredAssemblies.Add(assembly);
+ break;
+ }
+ }
+ }
+
+ private static List<AssemblyName> assemblyNameList;
+ private static List<AssemblyName> AssemblyNameList
+ {
+ get
+ {
+ if (null == assemblyNameList)
+ {
+ assemblyNameList = new List<AssemblyName>();
+ assemblyNameList.Add(EXamlExtensions.MainAssembly.GetName());
+
+ var assemblyNames = EXamlExtensions.MainAssembly.GetReferencedAssemblies();
+
+ foreach (var name in assemblyNames)
+ {
+ assemblyNameList.Add(name);
+ }
+ }
+
+ return assemblyNameList;
+ }
+ }
+
+ private string assemblyName;
+ internal static List<Assembly> GatheredAssemblies = new List<Assembly>();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherBindableProperties : Operation
+ {
+ public GatherBindableProperties(int typeIndex, string propertyName)
+ {
+ this.typeIndex = typeIndex;
+ this.propertyName = propertyName;
+ }
+
+ public void Do()
+ {
+ var type = GatherType.GatheredTypes[typeIndex];
+ var field = type.GetField(fi => fi.Name == propertyName && fi.IsStatic && fi.IsPublic);
+ if (null == field)
+ {
+ field = type.GetField(fi => fi.Name == propertyName && fi.IsStatic && !fi.IsPublic);
+ }
+
+ GatheredBindableProperties.Add(field.GetValue(null) as BindableProperty);
+ }
+
+ private int typeIndex;
+ private string propertyName;
+ internal static List<BindableProperty> GatheredBindableProperties = new List<BindableProperty>();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherConvertedValue : Operation
+ {
+ public GatherConvertedValue(int converterIndex, string value)
+ {
+ this.converterIndex = converterIndex;
+ this.value = value;
+ }
+
+ public void Do()
+ {
+ var converter = LoadEXaml.GatheredInstances[converterIndex] as TypeConverter;
+ LoadEXaml.GatheredInstances.Add(converter.ConvertFromInvariantString(value));
+ }
+
+ private int converterIndex;
+ private string value;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherEnumValue : Operation
+ {
+ public GatherEnumValue(int typeIndex, string value)
+ {
+ this.typeIndex = typeIndex;
+ this.value = value;
+ }
+
+ public void Do()
+ {
+ var enumType = GatherType.GatheredTypes[typeIndex];
+ LoadEXaml.GatheredInstances.Add(Enum.Parse(enumType, value));
+ }
+
+ private int typeIndex;
+ private string value;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherEvent : Operation
+ {
+ public GatherEvent(int typeIndex, string eventName)
+ {
+ this.typeIndex = typeIndex;
+ this.eventName = eventName;
+ }
+
+ public void Do()
+ {
+ var type = GatherType.GatheredTypes[typeIndex];
+ GatheredEvents.Add(type.GetEvent(eventName));
+ }
+
+ private int typeIndex;
+ private string eventName;
+ internal static List<EventInfo> GatheredEvents = new List<EventInfo>();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherMethod : Operation
+ {
+ public GatherMethod(int typeIndex, string methodName)
+ {
+ this.typeIndex = typeIndex;
+ this.methodName = methodName;
+ }
+
+ public void Do()
+ {
+ var type = GatherType.GatheredTypes[typeIndex];
+ var method = type.GetRuntimeMethods().FirstOrDefault(mi => mi.Name == methodName);
+ GatheredMethods.Add(method);
+ }
+
+ private int typeIndex;
+ private string methodName;
+ internal static List<MethodInfo> GatheredMethods = new List<MethodInfo>();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherProperty : Operation
+ {
+ public GatherProperty(int typeIndex, string propertyName)
+ {
+ this.typeIndex = typeIndex;
+ this.propertyName = propertyName;
+ }
+
+ public void Do()
+ {
+ var type = GatherType.GatheredTypes[typeIndex];
+ GatheredProperties.Add(type.GetProperty(propertyName));
+ }
+
+ private int typeIndex;
+ private string propertyName;
+ internal static List<PropertyInfo> GatheredProperties = new List<PropertyInfo>();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class GatherType : Operation
+ {
+ public GatherType(int assemblyIndex, string typeName, List<int> genericTypeIndexs = null)
+ {
+ this.assemblyIndex = assemblyIndex;
+ this.typeName = typeName;
+ this.genericTypeIndexs = genericTypeIndexs;
+ }
+
+ public void Do()
+ {
+ var assembly = GatherAssembly.GatheredAssemblies[assemblyIndex];
+ var type = assembly.GetType(typeName);
+
+ if (null != genericTypeIndexs)
+ {
+ Type[] args = new Type[genericTypeIndexs.Count];
+
+ for (int i = 0; i < genericTypeIndexs.Count; i++)
+ {
+ args[i] = GatheredTypes[genericTypeIndexs[i]];
+ }
+
+ type = type.MakeGenericType(args);
+ }
+
+ GatheredTypes.Add(type);
+ }
+
+ private int assemblyIndex;
+ private string typeName;
+ private List<int> genericTypeIndexs;
+
+ internal static List<Type> GatheredTypes = new List<Type>();
+ }
+
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal interface Operation
+ {
+ void Do();
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class RegisterXName : Operation
+ {
+ public RegisterXName(object instance, string name)
+ {
+ this.instance = instance;
+ this.name = name;
+ }
+
+ public void Do()
+ {
+ object realInstance = null;
+ if (instance is Instance)
+ {
+ realInstance = LoadEXaml.GatheredInstances[(instance as Instance).Index];
+ }
+ else
+ {
+ realInstance = instance;
+ }
+
+ var namescope = NameScope.GetNameScope(CreateInstance.Root as BindableObject);
+ namescope?.RegisterName(name, realInstance);
+ }
+
+ private object instance;
+ private string name;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetBindalbeProperty : Operation
+ {
+ public SetBindalbeProperty(int instanceIndex, int bindalbePropertyIndex, object value)
+ {
+ this.instanceIndex = instanceIndex;
+ this.bindalbePropertyIndex = bindalbePropertyIndex;
+ this.value = value;
+ }
+
+ public void Do()
+ {
+ var instance = LoadEXaml.GatheredInstances[instanceIndex] as BindableObject;
+
+ if (null != instance)
+ {
+ var property = GatherBindableProperties.GatheredBindableProperties[bindalbePropertyIndex];
+
+ if (value is Instance)
+ {
+ int valueIndex = (value as Instance).Index;
+ instance.SetValue(property, LoadEXaml.GatheredInstances[valueIndex]);
+ }
+ else
+ {
+ instance.SetValue(property, value);
+ }
+ }
+ }
+
+ private int instanceIndex;
+ private int bindalbePropertyIndex;
+ private object value;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetBinding : Operation
+ {
+ public SetBinding(int instanceIndex, int bindablePropertyIndex, int valueIndex)
+ {
+ this.instanceIndex = instanceIndex;
+ this.bindablePropertyIndex = bindablePropertyIndex;
+ this.valueIndex = valueIndex;
+ }
+
+ public void Do()
+ {
+ BindableObject bindableObject = LoadEXaml.GatheredInstances[instanceIndex] as BindableObject;
+ var property = GatherBindableProperties.GatheredBindableProperties[bindablePropertyIndex];
+ var value = LoadEXaml.GatheredInstances[valueIndex] as BindingBase;
+ bindableObject?.SetBinding(property, value);
+ }
+
+ private int instanceIndex;
+ private int bindablePropertyIndex;
+ private int valueIndex;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetDynamicResource : Operation
+ {
+ public SetDynamicResource(int instanceIndex, int propertyIndex, string key)
+ {
+ this.instanceIndex = instanceIndex;
+ this.propertyIndex = propertyIndex;
+ this.key = key;
+ }
+
+ public void Do()
+ {
+ var instance = LoadEXaml.GatheredInstances[instanceIndex] as BindableObject;
+ var property = GatherBindableProperties.GatheredBindableProperties[propertyIndex];
+
+ instance.SetDynamicResource(property, key);
+ }
+
+ private int instanceIndex;
+ private int propertyIndex;
+ private string key;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class SetProperty : Operation
+ {
+ public SetProperty(int instanceIndex, int propertyIndex, object value)
+ {
+ this.instanceIndex = instanceIndex;
+ this.propertyIndex = propertyIndex;
+ this.value = value;
+ }
+
+ public void Do()
+ {
+ object instance = LoadEXaml.GatheredInstances[instanceIndex];
+ var property = GatherProperty.GatheredProperties[propertyIndex];
+
+ if (value is Instance)
+ {
+ int valueIndex = (value as Instance).Index;
+ property.SetMethod.Invoke(instance, new object[] { LoadEXaml.GatheredInstances[valueIndex] });
+ }
+ else
+ {
+ property.SetMethod.Invoke(instance, new object[] { value });
+ }
+ }
+
+ private int instanceIndex;
+ private int propertyIndex;
+ private object value;
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Reflection;
+using System.Text;
+
+namespace Tizen.NUI.EXaml
+{
+ /// Internal used, will never be opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class EXamlExtensions
+ {
+ /// Internal used, will never be opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TXaml LoadFromEXamlPath<TXaml>(this TXaml view, string path)
+ {
+ //This EXaml file will be converted by Tizen.NUI.XamlBuild from the .xaml
+ string xamlScript = GetXamlFromPath(path);
+ LoadEXaml.Load(view, xamlScript);
+ return view;
+ }
+
+ /// Internal used, will never be opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TXaml LoadFromEXamlPath<TXaml>(this TXaml view, Type callingType)
+ {
+ if (null == callingType)
+ {
+ return view;
+ }
+
+ MainAssembly = view.GetType().Assembly;
+
+ string resourceName = callingType.Name + ".examl";
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+
+ Tizen.Log.Fatal("NUI", "the resource path: " + resource);
+ int windowWidth = NUIApplication.GetDefaultWindow().Size.Width;
+ int windowHeight = NUIApplication.GetDefaultWindow().Size.Height;
+
+ string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName;
+ Tizen.Log.Fatal("NUI", "the resource path: " + likelyResourcePath);
+
+ if (!File.Exists(likelyResourcePath))
+ {
+ likelyResourcePath = resource + "layout/" + resourceName;
+ }
+
+ //Find the xaml file in the layout folder
+ if (File.Exists(likelyResourcePath))
+ {
+ StreamReader reader = new StreamReader(likelyResourcePath);
+ var xaml = reader.ReadToEnd();
+ reader.Close();
+ reader.Dispose();
+
+ LoadEXaml.Load(view, xaml);
+ }
+
+ return view;
+ }
+
+ /// Internal used, will never be opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static Assembly MainAssembly
+ {
+ get;
+ set;
+ }
+
+ private static string GetXamlFromPath(string path)
+ {
+ string xaml;
+
+ if (File.Exists(path))
+ {
+ StreamReader reader = new StreamReader(path);
+ xaml = reader.ReadToEnd();
+ reader.Dispose();
+ return xaml;
+ }
+ return null;
+ }
+ }
+}