Пример #1
0
            private void CancelConnection()
            {
                var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                                                               PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                owningWorkspace.DynamoViewModel.ExecuteCommand(command);
            }
Пример #2
0
            private void CancelConnection()
            {
                var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                                                               PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                var dynamoViewModel = dynSettings.Controller.DynamoViewModel;

                dynamoViewModel.ExecuteCommand(command);
            }
Пример #3
0
            /// <summary>
            /// The owning WorkspaceView calls this to cancel the current state
            /// </summary>
            internal void CancelActiveState()
            {
                if (currentState == State.Connection)
                {
                    var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                                                                   PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                    var dynamoViewModel = dynSettings.Controller.DynamoViewModel;
                    dynamoViewModel.ExecuteCommand(command);
                }
                SetCurrentState(State.None);
                ignoreMouseClick = true;
            }
Пример #4
0
        public void TestMakeConnectionCommand()
        {
            Guid nodeId    = Guid.NewGuid();
            int  portIndex = randomizer.Next();
            var  portType  = ((PortType)randomizer.Next(2));
            var  mode      = ((DynCmd.MakeConnectionCommand.Mode)randomizer.Next(3));

            var cmdOne = new DynCmd.MakeConnectionCommand(
                nodeId, portIndex, portType, mode);

            var cmdTwo = DuplicateAndCompare(cmdOne);

            Assert.AreEqual(cmdOne.NodeId, cmdTwo.NodeId);
            Assert.AreEqual(cmdOne.PortIndex, cmdTwo.PortIndex);
            Assert.AreEqual(cmdOne.Type, cmdTwo.Type);
            Assert.AreEqual(cmdOne.ConnectionMode, cmdTwo.ConnectionMode);
        }
Пример #5
0
            internal bool HandleLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                if (false != ignoreMouseClick)
                {
                    ignoreMouseClick = false;
                    return(false);
                }

                bool eventHandled = false;

                if (this.currentState == State.Connection)
                {
                    // Clicking on the canvas while connecting simply cancels
                    // the operation and drop the temporary connector.
                    var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                                                                   PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                    var dynamoViewModel = dynSettings.Controller.DynamoViewModel;
                    dynamoViewModel.ExecuteCommand(command);

                    this.currentState = State.None;
                    eventHandled      = true; // Mouse event handled.
                }
                else if (this.currentState == State.None)
                {
                    // Record the mouse down position.
                    IInputElement element = sender as IInputElement;
                    mouseDownPos = e.GetPosition(element);

                    // We'll see if there is any node being clicked on. If so,
                    // then the state machine should initiate a drag operation.
                    if (null != GetSelectableFromPoint(mouseDownPos))
                    {
                        InitiateDragSequence();
                    }
                    else
                    {
                        InitiateWindowSelectionSequence();
                    }

                    eventHandled = true; // Mouse event handled.
                }

                dynSettings.ReturnFocusToSearch();
                return(eventHandled);
            }
Пример #6
0
            private void CancelConnection()
            {
                var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                        PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                var dynamoViewModel = dynSettings.Controller.DynamoViewModel;
                dynamoViewModel.ExecuteCommand(command);
            }
Пример #7
0
            private void CancelConnection()
            {
                var command = new DynCmd.MakeConnectionCommand(Guid.Empty, -1,
                        PortType.INPUT, DynCmd.MakeConnectionCommand.Mode.Cancel);

                owningWorkspace.DynamoViewModel.ExecuteCommand(command);
            }