//Fang: How to deal the Enum
string ret = "";
- if (null == valueObject)
+ if (System.Type.Missing == valueObject)
+ {
+ ret += "yy ";
+ }
+ else if (null == valueObject)
{
ret += "zz ";
}
VariableDefinition vardef = new VariableDefinition(typeref);
Context.Variables[node] = vardef;
- var argumentList = GetCtorXArguments(node, factoryCtorInfo.Parameters.Count);
+ var argumentList = GetCtorXArguments(node, factoryCtorInfo.Parameters.Count, true);
Context.Values[node] = new EXamlCreateObject(Context, null, typedef, argumentList.ToArray());
return;
}
VariableDefinition vardef = new VariableDefinition(typeref);
Context.Variables[node] = vardef;
- var argumentList = GetCtorXArguments(node, factoryMethodInfo.Parameters.Count);
+ var argumentList = GetCtorXArguments(node, factoryMethodInfo.Parameters.Count, false);
Context.Values[node] = new EXamlCreateObject(Context, null, typedef, factoryMethodInfo, argumentList?.ToArray());
return;
}
return true;
}
- List<object> GetCtorXArguments(ElementNode enode, int paramsCount)
+ List<object> GetCtorXArguments(ElementNode enode, int paramsCount, bool isConstructor)
{
if (!enode.Properties.ContainsKey(XmlName.xArguments))
{
argumentList.Add(Context.Values[arguments[i]]);
}
- for (int i = arguments.Count; i < paramsCount; i++)
+ if (!isConstructor)
{
- argumentList.Add(null);
+ for (int i = arguments.Count; i < paramsCount; i++)
+ {
+ argumentList.Add(Type.Missing);
+ }
}
return argumentList;
var realValue = context.Values[elementNode] as EXamlCreateObject;
if (null != realValue)
{
- if (realValue.GetType().InheritsFromOrImplements(propertyType))
+ var valueTypeRef = realValue.GetType();
+ if (valueTypeRef.InheritsFromOrImplements(propertyType))
+ {
+ return true;
+ }
+
+ var realTypeFromMarkupExtension = valueTypeRef.GetRealTypeIfIsMarkupExtension();
+
+ if (true == realTypeFromMarkupExtension?.InheritsFromOrImplements(propertyType))
{
return true;
}
else if (targetTypeRef.FullName == "System.UInt16")
yield return Instruction.Create(OpCodes.Ldc_I4, unchecked((int)UInt16.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.UInt32")
- yield return Instruction.Create(OpCodes.Ldc_I8, unchecked((uint)UInt32.Parse(str, CultureInfo.InvariantCulture)));
+ yield return Instruction.Create(OpCodes.Ldc_I4, unchecked((int)UInt32.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.UInt64")
yield return Instruction.Create(OpCodes.Ldc_I8, unchecked((long)UInt64.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.Single")
{
- if (str.EndsWith("dp") || str.EndsWith("px"))
+ if (null != GetDPValueSubFix(str))
{
var insOfDPValue = GetDPValue(module, node, targetTypeRef, str);
return typeRef.InheritsFromOrImplements(baseClass);
}
+ public static TypeReference GetRealTypeIfIsMarkupExtension(this TypeReference typeRef)
+ {
+ TypeReference ret = null;
+
+ var typeDef = typeRef.ResolveCached();
+
+ foreach (var @interface in typeDef.Interfaces)
+ {
+ if (@interface.InterfaceType is GenericInstanceType instanceType)
+ {
+ if ("Tizen.NUI.Xaml.IMarkupExtension`1" == instanceType.ElementType.FullName
+ &&
+ 1 == instanceType.GenericArguments.Count)
+ {
+ ret = instanceType.GenericArguments[0];
+ break;
+ }
+ }
+ }
+
+ if (null == ret)
+ {
+ ret = typeDef.BaseType?.GetRealTypeIfIsMarkupExtension();
+ }
+
+ return ret;
+ }
+
static CustomAttribute GetCustomAttribute(this TypeReference typeRef, TypeReference attribute)
{
var typeDef = typeRef.ResolveCached();
using Mono.Cecil;
-using Tizen.NUI.Xaml;
-using Mono.Cecil.Cil;
-using Mono.Cecil.Pdb;
-using Mono.Cecil.Mdb;
-
namespace Tizen.NUI.Xaml.Build.Tasks
{
[LoadInSeparateAppDomain]
Value = valueString[0];
break;
+ case 'y':
+ Value = Type.Missing;
+ break;
+
case 'z':
Value = null;
break;
*/
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Reflection;
using System.Text;
using Tizen.NUI.BaseComponents;
if (null == xFactoryMethod)
{
- obj = Activator.CreateInstance(type, paramList.ToArray());
+ obj = Activator.CreateInstance(type, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance | BindingFlags.OptionalParamBinding, null, paramList.ToArray(), CultureInfo.CurrentCulture);
}
else
{