Ejemplo n.º 1
0
        protected virtual bool OnBeforeRemoveItemEvent(EntityObject item)
        {
            BeforeRemoveItemEventHandler ae = this.BeforeRemoveItem;

            if (ae != null)
            {
                EntityCollectionEventArgs e = new EntityCollectionEventArgs(item);
                ae(this, e);
                return(e.Cancel);
            }
            return(false);
        }
Ejemplo n.º 2
0
 private void Entities_RemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     if (this.readOnly) return;
     if (e.Item.Type == EntityType.Hatch)
     {
         Hatch hatch = (Hatch)e.Item;
         foreach (HatchBoundaryPath path in hatch.BoundaryPaths)
         {
             this.Hatch_BoundaryPathRemoved(hatch, new ObservableCollectionEventArgs<HatchBoundaryPath>(path));
         }
         hatch.HatchBoundaryPathAdded -= this.Hatch_BoundaryPathAdded;
         hatch.HatchBoundaryPathRemoved -= this.Hatch_BoundaryPathRemoved;
     }
     this.OnEntityRemovedEvent(e.Item);
     e.Item.Owner = null;
 }
Ejemplo n.º 3
0
 private void Entities_BeforeRemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     // only items owned by the actual block can be removed
     e.Cancel = !ReferenceEquals(e.Item.Owner, this) || this.readOnly;
 }
Ejemplo n.º 4
0
 private void Entities_BeforeAddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     // null items, entities already owned by another Block, attribute definitions and attributes are not allowed in the entities list.
     if (e.Item == null)
         e.Cancel = true;
     else if (this.entities.Contains(e.Item))
         e.Cancel = true;
     else if (this.readOnly)
         e.Cancel = true;
     else if (e.Item is AttributeDefinition)
         e.Cancel = true;
     else if (e.Item.Owner != null)
     {
         // if the block does not belong to a document, all entities 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 entity document, are the same
         // this is handled by the BlocksRecordCollection
     }
     else
         e.Cancel = false;
 }
Ejemplo n.º 5
0
 private void Entities_AddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     if (this.readOnly) return;
     // if the entity is a hatch we will also add the boundary entities to the block
     if (e.Item.Type == EntityType.Hatch)
     {
         Hatch hatch = (Hatch) e.Item;
         foreach (HatchBoundaryPath path in hatch.BoundaryPaths)
         {
             this.Hatch_BoundaryPathAdded(hatch, new ObservableCollectionEventArgs<HatchBoundaryPath>(path));
         }
         hatch.HatchBoundaryPathAdded += this.Hatch_BoundaryPathAdded;
         hatch.HatchBoundaryPathRemoved += this.Hatch_BoundaryPathRemoved;
     }
     this.OnEntityAddedEvent(e.Item);
     e.Item.Owner = this;
 }
Ejemplo n.º 6
0
 private void Entities_RemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     this.OnEntityRemovedEvent(e.Item);
 }
Ejemplo n.º 7
0
 private void Entities_AddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     this.OnEntityAddedEvent(e.Item);
 }
Ejemplo n.º 8
0
 private void Entities_BeforeRemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
 }
Ejemplo n.º 9
0
 private void Entities_BeforeAddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     // null or duplicate items are not allowed in the entities list.
     if (e.Item == null)
         e.Cancel = true;
     else if (this.entities.Contains(e.Item))
         e.Cancel = true;
     else
         e.Cancel = false;
 }
Ejemplo n.º 10
0
 private void Entities_RemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     e.Item.RemoveReactor(this);
     this.OnEntityRemovedEvent(e.Item);
 }
Ejemplo n.º 11
0
 private void Entities_AddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     e.Item.AddReactor(this);
     this.OnEntityAddedEvent(e.Item);
 }
Ejemplo n.º 12
0
 private void Entities_RemoveItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     if (this.readOnly) return;
     this.OnEntityRemovedEvent(e.Item);
     e.Item.Owner = null;
 }
Ejemplo n.º 13
0
 private void Entities_AddItem(EntityCollection sender, EntityCollectionEventArgs e)
 {
     if (this.readOnly) return;
     this.OnEntityAddedEvent(e.Item);
     e.Item.Owner = this;
 }