BezierSegment NewBezierSegment(Add add)
    {
        BezierSegment bezierSegment = new BezierSegment(_currentPathObject);

        bezierSegment.SegmentCount  = _program.SEGMENTS_PER_CURVE;
        bezierSegment.Point         = _program.GetMouseCanvasPosition();
        bezierSegment.PointSelected = true;

        if (add == Add.First)
        {
            bezierSegment.AddCurvePoints(true);
            bezierSegment.isFirst = true;
        }
        else if (add == Add.ContinueAtStart)
        {
            _segments[0].SegmentCount = _program.SEGMENTS_PER_CURVE;
            _segments[0].Delete();
            _segments[0].AddCurvePoints();

            bezierSegment.AddCurvePoints(true);
            OrganizeNeighbors(bezierSegment, _segments[0]);
            _currentHoveredSegment.PointSelected = false;
        }
        else // ContinueAtEnd
        {
            bezierSegment.AddCurvePoints();
            OrganizeNeighbors(_segments[_segments.Count - 1], bezierSegment);
            _currentHoveredSegment.PointSelected = false;
        }
        return(bezierSegment);
    }
    public void CloseCurve()
    {
        BezierSegment first = _segments[0];

        first.isFirst      = false;
        first.SegmentCount = _program.SEGMENTS_PER_CURVE;
        first.Delete();
        first.AddCurvePoints();
        BezierSegment last = _segments[_segments.Count - 1];

        OrganizeNeighbors(last, _segments[0]);
        first.Update();

        first.PointSelected         = false;
        last.PointSelected          = false;
        _currentPathObject.IsClosed = true;

        _currentPathObject.UpdatePointsHandlesRenderer();
        _program.AllowPathObjectUpdate();
    }