private void OnGraphControlConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            var currentDragPoint = Mouse.GetPosition(GraphControl);
            var connection       = ViewModel.OnConnectionDragStarted(currentDragPoint);

            e.Connection = connection;
        }
        private void OnGraphControlConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            var sourceConnector  = (ConnectorViewModel)e.SourceConnector.DataContext;
            var currentDragPoint = Mouse.GetPosition(GraphControl);
            var connection       = ViewModel.OnConnectionDragStarted(sourceConnector, currentDragPoint);

            e.Connection = connection;
        }
        /*
         *  Unfortunately, this MVVM-friendly stuff didn't work with NetworkView:  ((
         *
         *  cal:Message.Attach="[Event ConnectionDragStarted] = [Action ConnectionDragStarted($eventArgs)];
         *                      [Event ConnectionDragging] = [Action ConnectionDragging($eventArgs)];
         *                      [Event ConnectionDragCompleted] = [Action ConnectionDragCompleted($eventArgs)]"
         */

        private void NetworkControl_ConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            var draggedOutConnector = (ConnectorViewModel)e.ConnectorDraggedOut;
            var dragPoint           = Mouse.GetPosition(networkControl);

            var context = DataContext as MainViewModel;

            e.Connection = context.ConnectionDragStarted(draggedOutConnector, dragPoint);
        }
Example #4
0
        private void networkControl_ConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            var draggedOutConnector = (ConnectorViewModel)e.ConnectorDraggedOut;
            var curDragPoint        = Mouse.GetPosition(NetworkControl);

            var connection = ViewModel.ConnectionDragStarted(draggedOutConnector, curDragPoint);

            e.Connection = connection;
        }
Example #5
0
    private void OnGraphControlConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
    {
        elementsCanvas ??= graphControl.FindDescendantOfType <Canvas>();
        var sourceConnector  = (ConnectorViewModel <QuestViewModel, QuestConnectionViewModel>)e.SourceConnector.DataContext !;
        var currentDragPoint = e.GetPosition(elementsCanvas);
        var connection       = ViewModel.OnConnectionDragStarted(sourceConnector, currentDragPoint);

        e.Connection = connection;
    }
Example #6
0
        /// 当用户[开始]拖动锚点连线时触发此事件
        private void networkControl_ConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            // 创建锚点的ViewModel
            var draggedOutConnector = (ConnectorViewModel)e.ConnectorDraggedOut;
            // 获取拖动的起始位置
            var curDragPoint = Mouse.GetPosition(networkControl);

            // "开始拖动"调用的方法,传入锚点和起始位置,获取到连线Connection
            var connection = this.ViewModel.ConnectionDragStarted(draggedOutConnector, curDragPoint);

            // 将连线写入到事件对象中去,这样才能在鼠标松开前一直保持这个连线
            e.Connection = connection;
        }
Example #7
0
        /// <summary>
        /// Event raised when the user has started to drag out a connection.
        /// </summary>
        private void networkControl_ConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e)
        {
            ConnectorViewModel draggedOutConnector = (ConnectorViewModel)e.ConnectorDraggedOut;

            System.Windows.Point curDragPoint = Mouse.GetPosition(networkControl);

            // Delegate the real work to the view model.
            ConnectionViewModel connection = ViewModel.ConnectionDragStarted(draggedOutConnector, curDragPoint);

            // Must return the view-model object that represents the connection via the event args.
            // This is so that NetworkView can keep track of the object while it is being dragged.
            e.Connection = connection;
        }
Example #8
0
        /// <summary>
        /// Event raised when the user has started to drag out a connection.
        /// </summary>
        private void networkControl_ConnectionDragStarted(Object sender, ConnectionDragStartedEventArgs e)
        {
            var draggedOutConnector = (EntryViewModel)e.ConnectorDraggedOut;
            var curDragPoint        = Mouse.GetPosition(networkControl);

            //
            // Delegate the real work to the view model.
            //
            var connection = this.ViewModel.ConnectionDragStarted(draggedOutConnector, curDragPoint);

            //
            // Must return the view-model object that represents the connection via the event args.
            // This is so that NetworkView can keep track of the object while it is being dragged.
            //
            e.Connection = connection;
        }