Interaction logic for Link.xaml
Inheritance: System.Windows.Controls.UserControl
示例#1
0
 public virtual void OnLink(LinkType t, Link l)
 {
     if (Link != null) Link(this, new LinkEventArgs(t, l));
 }
示例#2
0
 public virtual void OnErase(LinkType t, Link l)
 {
     if (Erase != null) Erase(this, new LinkEventArgs(t, l));
 }
示例#3
0
 public LinkEventArgs(LinkType t, Link i)
     : base()
 {
     type = t;
       id = i;
 }
示例#4
0
        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);
        }
示例#5
0
 void obj_Erase(Link id)
 {
     foreach (LinkLine line in mLines)
       {
     if (line.SourceLink == id || line.TargetLink == id)
     {
       line.Erase();
       mLines.Remove(line);
       break;
     }
       }
 }
示例#6
0
        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();
        }