Пример #1
0
        public List <IGraphicItem> GetGraphicItems(object obj)
        {
            if (mGraphicProperties.Count <= 0)
            {
                return(null);
            }

            List <IGraphicItem> graphics = new List <IGraphicItem>();

            foreach (var item in mGraphicProperties)
            {
                var property = item.GetValue(obj, null); //For now indexed property is not queried
                if (null != property)
                {
                    List <IGraphicItem> items = GraphicDataProvider.GetGraphicItemsFromObject(property);
                    if (null != items && items.Count > 0)
                    {
                        graphics.AddRange(items);
                    }
                }
            }
            if (graphics.Count > 0)
            {
                return(graphics);
            }

            return(null);
        }
Пример #2
0
        private List <PropertyInfo> GetGraphicProperties(System.Type type)
        {
            List <PropertyInfo> graphicProperties = new List <PropertyInfo>();

            PropertyInfo[] properties = type.GetProperties();
            foreach (var item in properties)
            {
                //Check if we have a data provider for this property type.
                IGraphicDataProvider provider = GraphicDataProvider.GetGraphicDataProviderForType(item.PropertyType);
                if (null != provider)
                {
                    graphicProperties.Add(item);
                }
            }

            return(graphicProperties);
        }