Beispiel #1
0
        /// <summary>
        ///		For LINQ expression generated collection.
        ///		Supports only 1D collection in current phase
        /// </summary>
        /// <param name="collection"></param>
        /// <returns></returns>
        internal static CollectionNode Create(ObservableCollection <ObjectNode> collection)
        {
            var collectionNode = new CollectionNode(typeof(ObservableCollection <ObjectNode>));

            foreach (var element in collection)
            {
                collectionNode.Collection.Add(element);
            }
            return(collectionNode);
        }
Beispiel #2
0
        /// <summary>
        ///		Create from property
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="propertyInfo"></param>
        /// <returns></returns>
        internal static ObjectNode Create(ObjectNode parent, PropertyInfo propertyInfo)
        {
            if (typeof(IEnumerable).IsAssignableFrom(propertyInfo.PropertyType) && !CollectionNode.NotEnumerables.Contains(propertyInfo.PropertyType))
            {
                return(CollectionNode.Create(parent, propertyInfo));
            }
            else
            {
                var objectNode = new ObjectNode(parent, propertyInfo.GetCustomAttribute <VisibleAttribute>());
                objectNode.SourceObjectInfo = new PropertyDomainModelRefInfo(propertyInfo);
                var setter = propertyInfo.SetMethod;
                objectNode.IsReadOnly = setter == null || !setter.IsPublic || !(setter.GetCustomAttribute <VisibleAttribute>()?.IsFeatureEnabled ?? true);
                objectNode._IsEnabled = !objectNode.IsReadOnly;

                return(objectNode);
            }
        }