示例#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();
		}
示例#2
0
 void Detach(Relationship relationship)
 {
     foreach(var m in ProjectInfo.Models)
         if(m != this && m.relationships.Contains(relationship))
             return ;
     relationship.Detach();
 }
示例#3
0
        protected internal void RemoveRelationship(Relationship relationship)
		{
			if (relationships.Contains(relationship))
			{
                Detach(relationship);
				relationship.Modified -= new EventHandler(ElementChanged);
				relationships.Remove(relationship);
				OnRelationRemoved(new RelationshipEventArgs(relationship));
			}
        }
示例#4
0
        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;
		}
示例#7
0
		protected virtual void CopyFrom(Relationship relationship)
		{
			label = relationship.label;
		}