コード例 #1
0
        internal override IPropertyEditorModel Create(XenParameter p)
        {
            var info = GetTypeEditorInfo(p.XenType);

            if (info == null)
            {
                return(null);
            }

            var model = CreateTypeEditorModel(info);

            if (model != null)
            {
                model.Property = new XenProperty
                {
                    XenType  = p.XenType,
                    CanRead  = true,
                    CanWrite = true,
                    Value    = p.Value,
                    Path     = new [] { p.ParameterName }
                };

                model.UseDefaultValue = false;
                model.DisplayName     = p.ParameterName;
                model.ToolboxValue    = p.Value;
                model.FullTypeName    = p.TypeName;
                model.ShortTypeName   = p.ShortTypeName;
            }

            return(model);
        }
コード例 #2
0
        public static XenConstructor[] GetConstructors(Type type)
        {
            if (type == null)
            {
                return new XenConstructor[] {}
            }
            ;

            var xctors = new List <XenConstructor>();
            var tctors = type.GetConstructors();

            foreach (var tctor in tctors)
            {
                if (tctor.IsAbstract)
                {
                    continue;
                }

                var xctor = new XenConstructor();

                var xparams = new List <XenParameter>();

                xctor.TypeName = type.AssemblyQualifiedName;

                foreach (var pi in tctor.GetParameters())
                {
                    var xparam = new XenParameter
                    {
                        ParameterName = pi.Name,
                        Position      = pi.Position,
                        TypeName      = pi.ParameterType.FullName,
                        IsTypeEnum    = pi.ParameterType.GetTypeInfo().IsEnum
                    };

                    xparams.Add(xparam);
                }

                xctor.Parameters = xparams.ToArray();
                xctors.Add(xctor);
            }

            return(xctors.ToArray());
        }
    }
コード例 #3
0
 internal abstract IPropertyEditorModel Create(XenParameter property);