public virtual void OnLink(LinkType t, Link l) { if (Link != null) Link(this, new LinkEventArgs(t, l)); }
public virtual void OnErase(LinkType t, Link l) { if (Erase != null) Erase(this, new LinkEventArgs(t, l)); }
public LinkEventArgs(LinkType t, Link i) : base() { type = t; id = i; }
public LinkLine(Canvas c, LinkType type, Link s) { Point p; mCanvas = c; if (type != LinkType.Out) { mStart = null; mEnd = s; mEndType = type; try { p = mEnd.TransformToAncestor(mCanvas).Transform(new Point(0, 0)); } catch (Exception) { p = new Point(0, 0); } } else { mStart = s; mEnd = null; try { p = mStart.TransformToAncestor(mCanvas).Transform(new Point(0, 0)); } catch (Exception) { p = new Point(0, 0); } } mLine = new Line() { Stroke = new SolidColorBrush(Colors.Green), StrokeThickness = 2, X1 = p.X+14, Y1 = p.Y +8, X2 = p.X+14, Y2 = p.Y+8 }; mCanvas.Children.Add(mLine); Canvas.SetZIndex(mLine, 0); }
void obj_Erase(Link id) { foreach (LinkLine line in mLines) { if (line.SourceLink == id || line.TargetLink == id) { line.Erase(); mLines.Remove(line); break; } } }
public void EndLink(LinkType type, Link e) { if (mEnd == null) { mEndType = type; mEnd = e; } else mStart = e; mStart.Connection = mEnd.Object; mEnd.Connection = mStart.Object; Update(); mEnd.Object.Attach(mEndType, mStart.Object.Module); mEnd.Object.Apply(); }