/// <exception cref="ArgumentNullException"> /// <paramref name="relationship"/> is null.-or- /// <paramref name="startShape"/> is null.-or- /// <paramref name="endShape"/> is null. /// </exception> protected Connection(Relationship relationship, Shape startShape, Shape endShape) { if (relationship == null) throw new ArgumentNullException("relationship"); if (startShape == null) throw new ArgumentNullException("startShape"); if (endShape == null) throw new ArgumentNullException("endShape"); this.startShape = startShape; this.endShape = endShape; InitOrientations(); bendPoints.Add(new BendPoint(startShape, true)); bendPoints.Add(new BendPoint(endShape, false)); startShape.Move += ShapeMoving; startShape.Resize += StartShapeResizing; endShape.Move += ShapeMoving; endShape.Resize += EndShapeResizing; relationship.Modified += delegate { OnModified(EventArgs.Empty); }; relationship.Detaching += delegate { startShape.Move -= ShapeMoving; startShape.Resize -= StartShapeResizing; endShape.Move -= ShapeMoving; endShape.Resize -= EndShapeResizing; }; relationship.Serializing += delegate(object sender, SerializeEventArgs e) { OnSerializing(e); }; relationship.Deserializing += delegate(object sender, SerializeEventArgs e) { OnDeserializing(e); }; Reroute(); }
void Detach(Relationship relationship) { foreach(var m in ProjectInfo.Models) if(m != this && m.relationships.Contains(relationship)) return ; relationship.Detach(); }
protected internal void RemoveRelationship(Relationship relationship) { if (relationships.Contains(relationship)) { Detach(relationship); relationship.Modified -= new EventHandler(ElementChanged); relationships.Remove(relationship); OnRelationRemoved(new RelationshipEventArgs(relationship)); } }
protected void AddRelationship(Relationship relationship) { relationships.Add(relationship); relationship.Modified += new EventHandler(ElementChanged); OnRelationAdded(new RelationshipEventArgs(relationship)); }
public RelationshipEventArgs(Relationship relationship) { this.relationship = relationship; }
protected override void CopyFrom(Relationship relationship) { base.CopyFrom(relationship); AssociationRelationship association = (AssociationRelationship) relationship; associationType = association.associationType; direction = association.direction; startRole = association.startRole; endRole = association.endRole; startMultiplicity = association.startMultiplicity; endMultiplicity = association.endMultiplicity; }
protected virtual void CopyFrom(Relationship relationship) { label = relationship.label; }