public ConnectionDragger(DiagramSurface surface, MainWindow window, Point startPoint, Connection originalConnection, bool isStartOfConnection)
            : base(surface, window, startPoint)
        {
            _OriginalConnection = originalConnection;
            _IsStartOfConnection = isStartOfConnection;
            _OriginalConnectionPoint = isStartOfConnection
                                       	? originalConnection.SourceConnectionPoint
                                       	: originalConnection.TargetConnectionPoint;
            _OriginalConnectionBrush = _OriginalConnection.Stroke;

            SetupMouse();
        }
Exemple #2
0
        public void RemoveUnusedConnectionPoints()
        {
            var cpsToRemove = new List <ConnectionPoint>();

            foreach (var cp in _ConnectionPoints)
            {
                ConnectionPoint cp1 = cp;
                if (_Connections.Any(c => c.SourceConnectionPoint == cp1 || c.TargetConnectionPoint == cp1))
                {
                    continue;
                }

                cpsToRemove.Add(cp);
            }

            // Remove all of the connection points identified as free
            cpsToRemove.ForEach(RemoveConnectionPoint);
        }
Exemple #3
0
 public Connection(ConnectionPoint sourceConnectionPoint)
     : this()
 {
     SourceConnectionPoint = sourceConnectionPoint;
 }
Exemple #4
0
        public static void SetConnectionStartPointBinding(Connection connection, ConnectionPoint connPoint)
        {
            if (connPoint == null) throw new ArgumentNullException("connPoint");

            connection.SetBinding(StartPointProperty, new Binding { Source = connPoint, Path = new PropertyPath(ConnectionPoint.LocationProperty) });
            connection.SourceConnectionPoint = connPoint;
        }
Exemple #5
0
 public static void SetConnectionPointBinding(Connection connection, ConnectionPoint sourceConnPoint, ConnectionPoint targetConnPoint)
 {
     SetConnectionStartPointBinding(connection, sourceConnPoint);
     SetConnectionEndPointBinding(connection, targetConnPoint);
 }
        protected bool CanConnect(ConnectionPoint connectionPoint)
        {
            DiagramShape sourceShape = _IsStartOfConnection ? _OriginalConnection.Target : _OriginalConnection.Source;

            return _Surface.Controller.CanConnect(connectionPoint.ParentShape, sourceShape);
        }
        public NewConnectionDragger(DiagramSurface surface, MainWindow window, Point startPoint, ConnectionPoint startConnectionPoint)
            : base(surface, window, startPoint, new Connection(startConnectionPoint), false)
        {
            _OriginalConnection.AddToSurface(surface);
            _OriginalConnection.Source = startConnectionPoint.ParentShape;
            Connection.SetConnectionStartPointBinding(_OriginalConnection, startConnectionPoint);

            _OriginalConnection.EndPoint = Mouse.GetPosition(_Surface);
        }
 public Connection(ConnectionPoint sourceConnectionPoint) : this()
 {
     SourceConnectionPoint = sourceConnectionPoint;
 }
 public static void SetConnectionPointBinding(Connection connection, ConnectionPoint sourceConnPoint, ConnectionPoint targetConnPoint)
 {
     SetConnectionStartPointBinding(connection, sourceConnPoint);
     SetConnectionEndPointBinding(connection, targetConnPoint);
 }
Exemple #10
0
 public void RemoveConnectionPoint(ConnectionPoint p)
 {
     p.RemoveFromSurface(Surface);
     _ConnectionPoints.Remove(p);
 }
 public Point Convert(DiagramShape shape, ConnectionPoint connectionPoint)
 {
     return Convert(Canvas.GetLeft(shape), Canvas.GetTop(shape), shape.ActualWidth, shape.ActualHeight,
                    connectionPoint.Side, connectionPoint.Position);
 }
Exemple #12
0
 public void RemoveConnectionPoint(ConnectionPoint p)
 {
     p.RemoveFromSurface(Surface);
     _ConnectionPoints.Remove(p);
 }
Exemple #13
0
 public ConnectionPoint AddAnotherConnectionPointAt(SideOfShape side, double position)
 {
     var item = new ConnectionPoint(this, side, position);
     _ConnectionPoints.Add(item);
     item.AddToSurface(Surface);
     return item;
 }