public void AddActivityPath(string pathName, string startingPoint, string targetingPoint, string condition, string describe)
        {
            var v = ActivityPathList.Count(p => p.起点 == startingPoint && p.路由 == condition);

            if (v != 0)
            {
                MessageBox.Show("每个[起点]的[路由条件]只能指向一个[目标],如果要重新指定,请删除原指向");
                return;
            }

            if (startingPoint == targetingPoint)
            {
                return;
            }

            if (string.IsNullOrEmpty(pathName))
            {
                link_n   = link_n + 1;
                pathName = "link" + link_n.ToString();
            }

            if (NameList.Exists(p => p == pathName))
            {
                return;
            }

            Path pt = new Path();

            pt.MouseEnter         += new MouseEventHandler(pt_MouseEnter);
            pt.MouseLeave         += new MouseEventHandler(pt_MouseLeave);
            pt.MouseRightButtonUp += new MouseButtonEventHandler(pt_MouseRightButtonUp);
            pt.Name = pathName;
            ActivityPath ptr = new ActivityPath();

            ptr.连线 = pt;
            ptr.说明 = describe;
            ptr.目标 = targetingPoint;
            ptr.起点 = startingPoint;
            ptr.路由 = condition;
            ptr.标签 = new TextBlock()
            {
                Text = condition, Name = "tb_" + pathName
            };
            myDesigner.Children.Add(ptr.标签);
            this.myDesigner.Children.Add(pt);
            ActivityPathList.Add(ptr);



            RefurbishActivityPath();
        }
        void DrawActivityPath(ActivityControl startingActivity, ActivityControl targetingActivity, Path pathObject, ActivityPath activityPath)
        {
            int i = startingActivity.分支集合.FindIndex(p => p == activityPath.路由);
            int l = 0;
            for (int n = 0; n <= i; n++)
            {
                l = startingActivity.分支集合[n].Length + l;
            }
            //double x1 = Canvas.GetLeft(起点) + 起点.Width - 15;

            double x1=0;
            double y1=0;

            switch (activityPath.路由)
            {

                case "开始状态":
                    x1 = Canvas.GetLeft(startingActivity) + startingActivity.Width / 2;
                    y1 = Canvas.GetTop(startingActivity) + startingActivity.Height;
                    break;

                case "回归":
                    x1 = Canvas.GetLeft(startingActivity) + startingActivity.Width / 2;
                    y1 = Canvas.GetTop(startingActivity) + startingActivity.Height;
                    break;
                default:
                    x1 = Canvas.GetLeft(startingActivity) + 6 + (l * 11) + i * 5;
                    y1 = Canvas.GetTop(startingActivity) + startingActivity.Height - 10;
                    break;
            }

            double x4 = Canvas.GetLeft(targetingActivity) + 20;
            double y4 = Canvas.GetTop(targetingActivity);

            double x2 = x1;
            double y2 = y1 + 100;

            double x3 = x4;
            double y3 = y4 - 100;

            PathFigure 形状子部分 = new PathFigure();
            PathSegmentCollection 串线 = new PathSegmentCollection();
            PathFigureCollection 形状集合 = new PathFigureCollection();
            PathGeometry 形状 = new PathGeometry();
            形状子部分.StartPoint = new Point(x1, y1);
            形状子部分.Segments = 串线;
            形状集合.Add(形状子部分);
            形状.Figures = 形状集合;

            pathObject.Data = 形状;
            pathObject.Stroke = System.Windows.Media.Brushes.Black;
            pathObject.StrokeThickness = 1;

            //BezierSegment b = new BezierSegment();

            //b.Point1 = new Point(x2, y2);
            //b.Point2 = new Point(x3, y3);
            //b.Point3 = new Point(x4, y4);

            LineSegment b = new LineSegment();
            b.Point = new Point(x4, y4);

            串线.Add(b);
            串线.Add(new LineSegment() { Point = new Point() { Y = y4 - 10, X = x4 + 5 } });
            串线.Add(new LineSegment() { Point = new Point() { Y = y4 - 10, X = x4 + 4 } });
            串线.Add(new LineSegment() { Point = new Point() { Y = y4, X = x4 } });
            串线.Add(new LineSegment() { Point = new Point() { Y = y4 - 10, X = x4 - 5 } });
            串线.Add(new LineSegment() { Point = new Point() { Y = y4 - 10, X = x4 - 6 } });

            Canvas.SetLeft(activityPath.标签, x1 + (x4 - x1) / 2);
            Canvas.SetTop(activityPath.标签, y4 - (y4 - y1) / 2);
        }
        public void AddActivityPath(string pathName, string startingPoint, string targetingPoint,string condition, string describe)
        {
            var v = ActivityPathList.Count(p => p.起点 == startingPoint && p.路由 == condition);

            if (v != 0)
            {
                MessageBox.Show("每个[起点]的[路由条件]只能指向一个[目标],如果要重新指定,请删除原指向");
                return;
            }

            if (startingPoint == targetingPoint)
            {
                return;
            }

            if (string.IsNullOrEmpty(pathName))
            {
                link_n = link_n + 1;
                pathName = "link" + link_n.ToString();
            }

            if (NameList.Exists(p => p == pathName))
            {
                return;
            }

            Path pt = new Path();
            pt.MouseEnter += new MouseEventHandler(pt_MouseEnter);
            pt.MouseLeave += new MouseEventHandler(pt_MouseLeave);
            pt.MouseRightButtonUp += new MouseButtonEventHandler(pt_MouseRightButtonUp);
            pt.Name = pathName;
            ActivityPath ptr = new ActivityPath();
            ptr.连线 = pt;
            ptr.说明 = describe;
            ptr.目标 = targetingPoint;
            ptr.起点 = startingPoint;
            ptr.路由 = condition;
            ptr.标签 = new TextBlock() { Text = condition, Name = "tb_" + pathName };
            myDesigner.Children.Add(ptr.标签);
            this.myDesigner.Children.Add(pt);
            ActivityPathList.Add(ptr);

            RefurbishActivityPath();
        }
        void DrawActivityPath(ActivityControl startingActivity, ActivityControl targetingActivity, Path pathObject, ActivityPath activityPath)
        {
            int i = startingActivity.分支集合.FindIndex(p => p == activityPath.路由);
            int l = 0;

            for (int n = 0; n <= i; n++)
            {
                l = startingActivity.分支集合[n].Length + l;
            }
            //double x1 = Canvas.GetLeft(起点) + 起点.Width - 15;

            double x1 = 0;
            double y1 = 0;

            switch (activityPath.路由)
            {
            case "开始状态":
                x1 = Canvas.GetLeft(startingActivity) + startingActivity.Width / 2;
                y1 = Canvas.GetTop(startingActivity) + startingActivity.Height;
                break;

            case "回归":
                x1 = Canvas.GetLeft(startingActivity) + startingActivity.Width / 2;
                y1 = Canvas.GetTop(startingActivity) + startingActivity.Height;
                break;

            default:
                x1 = Canvas.GetLeft(startingActivity) + 6 + (l * 11) + i * 5;
                y1 = Canvas.GetTop(startingActivity) + startingActivity.Height - 10;
                break;
            }



            double x4 = Canvas.GetLeft(targetingActivity) + 20;
            double y4 = Canvas.GetTop(targetingActivity);

            double x2 = x1;
            double y2 = y1 + 100;

            double x3 = x4;
            double y3 = y4 - 100;

            PathFigure            形状子部分 = new PathFigure();
            PathSegmentCollection 串线    = new PathSegmentCollection();
            PathFigureCollection  形状集合  = new PathFigureCollection();
            PathGeometry          形状    = new PathGeometry();

            形状子部分.StartPoint = new Point(x1, y1);
            形状子部分.Segments   = 串线;
            形状集合.Add(形状子部分);
            形状.Figures = 形状集合;



            pathObject.Data            = 形状;
            pathObject.Stroke          = System.Windows.Media.Brushes.Black;
            pathObject.StrokeThickness = 1;



            //BezierSegment b = new BezierSegment();

            //b.Point1 = new Point(x2, y2);
            //b.Point2 = new Point(x3, y3);
            //b.Point3 = new Point(x4, y4);

            LineSegment b = new LineSegment();

            b.Point = new Point(x4, y4);

            串线.Add(b);
            串线.Add(new LineSegment()
            {
                Point = new Point()
                {
                    Y = y4 - 10, X = x4 + 5
                }
            });
            串线.Add(new LineSegment()
            {
                Point = new Point()
                {
                    Y = y4 - 10, X = x4 + 4
                }
            });
            串线.Add(new LineSegment()
            {
                Point = new Point()
                {
                    Y = y4, X = x4
                }
            });
            串线.Add(new LineSegment()
            {
                Point = new Point()
                {
                    Y = y4 - 10, X = x4 - 5
                }
            });
            串线.Add(new LineSegment()
            {
                Point = new Point()
                {
                    Y = y4 - 10, X = x4 - 6
                }
            });



            Canvas.SetLeft(activityPath.标签, x1 + (x4 - x1) / 2);
            Canvas.SetTop(activityPath.标签, y4 - (y4 - y1) / 2);
        }