private void AttributeDefinitions_RemoveItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { OnAttributeDefinitionRemovedEvent(e.Item); e.Item.Owner = null; if (attributes.Count == 0) { flags &= ~BlockTypeFlags.NonConstantAttributeDefinitions; } }
private void AttributeDefinitions_ItemAdd(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { OnAttributeDefinitionAddedEvent(e.Item); e.Item.Owner = this; // the block has attributes flags |= BlockTypeFlags.NonConstantAttributeDefinitions; }
private void AttributeDefinitions_BeforeRemoveItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { // only attribute definitions owned by the actual block can be removed e.Cancel = !ReferenceEquals(e.Item.Owner, this); }
private void AttributeDefinitions_RemoveItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { if (this.readOnly) { return; } this.OnAttributeDefinitionRemovedEvent(e.Item); e.Item.Owner = null; if (this.attributes.Count == 0) { this.flags &= ~BlockTypeFlags.NonConstantAttributeDefinitions; } }
private void AttributeDefinitions_BeforeAddItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { // attributes with the same tag, and attribute definitions already owned by another Block are not allowed in the attributes list. if (e.Item == null) { e.Cancel = true; } else if (Flags.HasFlag(BlockTypeFlags.ExternallyDependent)) { e.Cancel = true; } else if (Name.StartsWith(DefaultPaperSpaceName)) // paper space blocks do not contain attribute definitions { e.Cancel = true; } else if (attributes.ContainsTag(e.Item.Tag)) { e.Cancel = true; } else if (e.Item.Owner != null) { // if the block does not belong to a document, all attribute definitions which owner is not null will be rejected if (Record.Owner == null) { e.Cancel = true; } // if the block belongs to a document, the entity will be added to the block only if both, the block and the attribute definitions document, are the same // this is handled by the BlocksRecordCollection } else { e.Cancel = false; } }
private void AttributeDefinitions_BeforeAddItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { // null, attributes with the same tag, and attribute definitions already owned by another Block are not allowed in the attributes list. if (e.Item == null) { e.Cancel = true; } else if (this.attributes.ContainsTag(e.Item.Tag)) { e.Cancel = true; } else if (this.readOnly) { e.Cancel = true; } else if (e.Item.Owner != null) { // if the block does not belong to a document, all attribute definitions which owner is not null will be rejected if (this.Record.Owner == null) { e.Cancel = true; } // if the block belongs to a document, the entity will be added to the block only if both, the block and the attribute definitions document, are the same // this is handled by the BlocksRecordCollection } else { e.Cancel = false; } }
private void AttributeDefinitions_RemoveItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { e.Item.Owner = null; }
private void AttributeDefinitions_ItemAdd(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { e.Item.Owner = this; }
private void AttributeDefinitions_BeforeAddItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { // null, attributes with the same tag, and attribute definitions already owned by another Block are not allowed in the attributes list. if (e.Item == null) { e.Cancel = true; } else if (this.attributes.ContainsTag(e.Item.Tag)) { e.Cancel = true; } else if (e.Item.Owner != null) { e.Cancel = true; } else { e.Cancel = false; } }
private void AttributeDefinitions_BeforeAddItem(AttributeDefinitionDictionary sender, AttributeDefinitionDictionaryEventArgs e) { // attributes with the same tag, and attribute definitions already owned by another Block are not allowed in the attributes list. if (e.Item == null) { e.Cancel = true; } else if (this.Flags.HasFlag(BlockTypeFlags.ExternallyDependent)) { e.Cancel = true; } else if (this.Name.StartsWith(DefaultPaperSpaceName)) // paper space blocks do not contain attribute definitions { e.Cancel = true; } else if (this.attributes.ContainsTag(e.Item.Tag)) { e.Cancel = true; } else if (e.Item.Owner != null) { e.Cancel = true; } else { e.Cancel = false; } }