Inheritance: Element, ISerializableElement
Esempio n. 1
0
		/// <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();
		}
Esempio n. 2
0
		public RelationshipEventArgs(Relationship relationship)
		{
			this.relationship = relationship;
		}
Esempio n. 3
0
		protected virtual void CopyFrom(Relationship relationship)
		{
			label = relationship.label;
		}
 public RelationshipEventArgs(Relationship relationship)
 {
     Relationship = relationship;
 }
Esempio n. 5
0
 private void AddRelationship(Relationship relationship)
 {
     relationships.Add(relationship);
     relationship.Modified += ElementChanged;
     OnRelationAdded(new RelationshipEventArgs(relationship));
 }
Esempio n. 6
0
		public void RemoveRelationship(Relationship relationship)
		{
			if (relationships.Contains(relationship))
			{
				relationship.Detach();
				relationship.Modified -= ElementChanged;
				relationships.Remove(relationship);
				OnRelationRemoved(new RelationshipEventArgs(relationship));
			}
		}
Esempio n. 7
0
		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;
		}
Esempio n. 8
0
 protected virtual void CopyFrom(Relationship relationship)
 {
     _label = relationship._label;
 }