Exemplo 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();
		}
Exemplo n.º 2
0
 void Detach(Relationship relationship)
 {
     foreach(var m in ProjectInfo.Models)
         if(m != this && m.relationships.Contains(relationship))
             return ;
     relationship.Detach();
 }
Exemplo n.º 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));
			}
        }
Exemplo n.º 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;
		}
Exemplo n.º 7
0
		protected virtual void CopyFrom(Relationship relationship)
		{
			label = relationship.label;
		}