Ejemplo n.º 1
0
        protected override Geometry Convert(MultiValueConverterProvider valueProvider)
        {
            var begin = valueProvider.Get <Position>(0);
            var end   = valueProvider.Get <Position>(1);
            var index = valueProvider.Get <int>(2);

            begin = new Position(
                begin.X + InputsXOffset + index * InputsDistance,
                begin.Y + InputsYOffset);

            end = new Position(
                end.X,
                end.Y + OutputYOffset);

            return(new PathGeometry
            {
                Figures = new PathFigureCollection {
                    new PathFigure
                    {
                        StartPoint = new System.Windows.Point(begin.X, begin.Y),
                        IsClosed = false,
                        Segments = new PathSegmentCollection {
                            new BezierSegment
                            {
                                Point1 = new System.Windows.Point(begin.X, end.Y),
                                Point2 = new System.Windows.Point(end.X, begin.Y),
                                Point3 = new System.Windows.Point(end.X, end.Y)
                            }
                        }
                    }
                }
            });
        }
Ejemplo n.º 2
0
        protected override bool Convert(MultiValueConverterProvider valueProvider)
        {
            if (!valueProvider.TryGet <NodeViewModel>(0, out var from))
            {
                return(false);
            }

            if (!valueProvider.TryGet <NodeViewModel>(1, out var to))
            {
                return(false);
            }

            return(!Contains(to, from));
        }
Ejemplo n.º 3
0
 protected override Point Convert(MultiValueConverterProvider valueProvider)
 {
     return(new Point(
                valueProvider.Get <double>(0),
                valueProvider.Get <double>(1)));
 }