コード例 #1
0
 /// <summary>
 /// Добавление свойства <see cref="IntellectualEntityProperty"/> в коллекцию
 /// </summary>
 /// <param name="property">Свойство <see cref="IntellectualEntityProperty"/></param>
 public void AddProperty(IntellectualEntityProperty property)
 {
     property.PropertyChanged += Property_PropertyChanged;
     EntityPropertyDataCollection.Add(property);
 }
コード例 #2
0
        private void Create(BlockReference blockReference)
        {
            if (blockReference == null)
            {
                _blkRefObjectId = ObjectId.Null;
                return;
            }

            var intellectualEntity = EntityReaderService.Instance.GetFromEntity(blockReference);

            if (intellectualEntity != null)
            {
                _intellectualEntity = intellectualEntity;

                var entityType = intellectualEntity.GetType();
                EntityType = entityType;
                foreach (var propertyInfo in entityType.GetProperties().Where(x => x.GetCustomAttribute <EntityPropertyAttribute>() != null))
                {
                    var attribute = propertyInfo.GetCustomAttribute <EntityPropertyAttribute>();
                    if (attribute != null)
                    {
                        if (attribute.Name == "Style")
                        {
                            var property = new IntellectualEntityProperty(
                                attribute,
                                entityType,
                                StyleManager.GetStyleNameByGuid(entityType, _intellectualEntity.StyleGuid),
                                _blkRefObjectId);
                            property.PropertyChanged += Property_PropertyChanged;
                            Properties.Add(property);
                        }
                        else if (attribute.Name == "LayerName")
                        {
                            var property = new IntellectualEntityProperty(
                                attribute,
                                entityType,
                                blockReference.Layer,
                                _blkRefObjectId);
                            property.PropertyChanged += Property_PropertyChanged;
                            Properties.Add(property);
                        }
                        else if (attribute.Name == "LineType")
                        {
                            var property = new IntellectualEntityProperty(
                                attribute,
                                entityType,
                                blockReference.Linetype,
                                _blkRefObjectId);
                            property.PropertyChanged += Property_PropertyChanged;
                            Properties.Add(property);
                        }
                        else
                        {
                            var value = propertyInfo.GetValue(intellectualEntity);
                            if (value != null)
                            {
                                var property = new IntellectualEntityProperty(
                                    attribute,
                                    entityType,
                                    value,
                                    _blkRefObjectId);
                                property.PropertyChanged += Property_PropertyChanged;
                                Properties.Add(property);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
 private void EntityPropertyProviderOnOnLockedLayerEventHandler(object sender, IntellectualEntityProperty e)
 {
     _hasObjectOnLockedLayer = true;
 }