Beispiel #1
0
        private NSView GetValueView(Type representationType)
        {
            Type[] genericArgs = null;
            Type   valueRenderType;

            if (!ValueTypes.TryGetValue(representationType, out valueRenderType))
            {
                if (representationType.IsConstructedGenericType)
                {
                    genericArgs = representationType.GetGenericArguments();
                    var type = representationType.GetGenericTypeDefinition();
                    ValueTypes.TryGetValue(type, out valueRenderType);
                }
            }
            if (valueRenderType == null)
            {
                return(null);
            }

            if (valueRenderType.IsGenericTypeDefinition)
            {
                if (genericArgs == null)
                {
                    genericArgs = representationType.GetGenericArguments();
                }
                valueRenderType = valueRenderType.MakeGenericType(genericArgs);
            }

            return(SetUpRenderer(valueRenderType));
        }
Beispiel #2
0
        public override IValueView CreateView(IHostResourceProvider hostResources, Type valueType)
        {
            if (!ValueTypes.TryGetValue(valueType, out Type viewType))
            {
                return(null);
            }

            return((IValueView)Activator.CreateInstance(viewType, hostResources));
        }