Interaction logic for Link.xaml
상속: 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();
        }