void MakeConnectionImpl(MakeConnectionCommand command)
        {
            Guid nodeId = command.ModelGuid;

            switch (command.ConnectionMode)
            {
            case MakeConnectionCommand.Mode.Begin:
                BeginConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.End:
                EndConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.BeginShiftReconnections:
                BeginShiftReconnections(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.EndShiftReconnections:
                EndShiftReconnections(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.EndAndStartCtrlConnection:
                EndAndStartCtrlConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.Cancel:
                CancelConnections();
                break;
            }
        }
Exemple #2
0
            /// <summary>
            /// Call this static method to reconstruct a RecordableCommand-derived
            /// object given an XmlElement that was previously saved with Serialize
            /// method. This method simply redirects the XmlElement to respective
            /// RecordableCommand-derived classes based on its type.
            /// </summary>
            /// <param name="element">The XmlElement from which the RecordableCommand
            /// can be reconstructed.</param>
            /// <returns>Returns the reconstructed RecordableCommand object. If a
            /// RecordableCommand cannot be reconstructed, this method throws a
            /// relevant exception.</returns>
            ///
            internal static RecordableCommand Deserialize(XmlElement element)
            {
                if (string.IsNullOrEmpty(element.Name))
                {
                    throw new ArgumentException("XmlElement without name");
                }

                RecordableCommand command = null;

                switch (element.Name)
                {
                case "CreateNodeCommand":
                    command = CreateNodeCommand.DeserializeCore(element);
                    break;

                case "SelectModelCommand":
                    command = SelectModelCommand.DeserializeCore(element);
                    break;

                case "CreateNoteCommand":
                    command = CreateNoteCommand.DeserializeCore(element);
                    break;

                case "SelectInRegionCommand":
                    command = SelectInRegionCommand.DeserializeCore(element);
                    break;

                case "DragSelectionCommand":
                    command = DragSelectionCommand.DeserializeCore(element);
                    break;

                case "MakeConnectionCommand":
                    command = MakeConnectionCommand.DeserializeCore(element);
                    break;

                case "DeleteModelCommand":
                    command = DeleteModelCommand.DeserializeCore(element);
                    break;

                case "UndoRedoCommand":
                    command = UndoRedoCommand.DeserializeCore(element);
                    break;

                case "UpdateModelValueCommand":
                    command = UpdateModelValueCommand.DeserializeCore(element);
                    break;
                }

                if (null != command)
                {
                    command.IsInPlaybackMode = true;
                    return(command);
                }

                string message = string.Format("Unknown command: {0}", element.Name);

                throw new ArgumentException(message);
            }
        void MakeConnectionImpl(MakeConnectionCommand command)
        {
            System.Guid nodeId = command.NodeId;

            switch (command.ConnectionMode)
            {
            case MakeConnectionCommand.Mode.Begin:
                BeginConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.End:
                EndConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.Cancel:
                activeStartPort = null;
                break;
            }
        }
Exemple #4
0
        private void MakeConnectionImpl(MakeConnectionCommand command)
        {
            System.Guid nodeId = command.NodeId;

            switch (command.ConnectionMode)
            {
            case MakeConnectionCommand.Mode.Begin:
                CurrentSpaceViewModel.BeginConnection(
                    nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.End:
                CurrentSpaceViewModel.EndConnection(
                    nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.Cancel:
                CurrentSpaceViewModel.CancelConnection();
                break;
            }
        }
        private void MakeConnectionImpl(MakeConnectionCommand command)
        {
            Guid nodeId = command.ModelGuid;

            switch (command.ConnectionMode)
            {
            case MakeConnectionCommand.Mode.Begin:
                BeginConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.End:
                EndConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.BeginShiftReconnections:
                BeginShiftReconnections(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.EndShiftReconnections:
                EndShiftReconnections(nodeId, command.PortIndex, command.Type);
                break;

            // TODO - can be removed in Dynamo 3.0 - DYN-1729
            case MakeConnectionCommand.Mode.EndAndStartCtrlConnection:
                BeginCreateConnections(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.BeginDuplicateConnection:
                BeginDuplicateConnection(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.BeginCreateConnections:
                BeginCreateConnections(nodeId, command.PortIndex, command.Type);
                break;

            case MakeConnectionCommand.Mode.Cancel:
                CancelConnections();
                break;
            }
        }
Exemple #6
0
            /// <summary>
            /// Call this static method to reconstruct a RecordableCommand-derived
            /// object given an XmlElement that was previously saved with Serialize
            /// method. This method simply redirects the XmlElement to respective
            /// RecordableCommand-derived classes based on its type.
            /// </summary>
            /// <param name="element">The XmlElement from which the RecordableCommand
            /// can be reconstructed.</param>
            /// <returns>Returns the reconstructed RecordableCommand object. If a
            /// RecordableCommand cannot be reconstructed, this method throws a
            /// relevant exception.</returns>
            ///
            internal static RecordableCommand Deserialize(XmlElement element)
            {
                if (string.IsNullOrEmpty(element.Name))
                {
                    throw new ArgumentException("XmlElement without name");
                }

                switch (element.Name)
                {
                case "CreateNodeCommand":
                    return(CreateNodeCommand.DeserializeCore(element));

                case "SelectModelCommand":
                    return(SelectModelCommand.DeserializeCore(element));

                case "CreateNoteCommand":
                    return(CreateNoteCommand.DeserializeCore(element));

                case "SelectInRegionCommand":
                    return(SelectInRegionCommand.DeserializeCore(element));

                case "DragSelectionCommand":
                    return(DragSelectionCommand.DeserializeCore(element));

                case "MakeConnectionCommand":
                    return(MakeConnectionCommand.DeserializeCore(element));

                case "DeleteModelCommand":
                    return(DeleteModelCommand.DeserializeCore(element));

                case "UndoRedoCommand":
                    return(UndoRedoCommand.DeserializeCore(element));
                }

                string message = string.Format("Unknown command: {0}", element.Name);

                throw new ArgumentException(message);
            }
Exemple #7
0
        private void MakeConnectionImpl(MakeConnectionCommand command)
        {
            System.Guid nodeId = command.NodeId;

            switch (command.ConnectionMode)
            {
                case MakeConnectionCommand.Mode.Begin:
                    CurrentSpaceViewModel.BeginConnection(
                        nodeId, command.PortIndex, command.Type);
                    break;

                case MakeConnectionCommand.Mode.End:
                    CurrentSpaceViewModel.EndConnection(
                        nodeId, command.PortIndex, command.Type);
                    break;

                case MakeConnectionCommand.Mode.Cancel:
                    CurrentSpaceViewModel.CancelConnection();
                    break;
            }
        }
        void MakeConnectionImpl(MakeConnectionCommand command)
        {
            Guid nodeId = command.ModelGuid;

            switch (command.ConnectionMode)
            {
                case MakeConnectionCommand.Mode.Begin:
                    BeginConnection(nodeId, command.PortIndex, command.Type);
                    break;

                case MakeConnectionCommand.Mode.End:
                    EndConnection(nodeId, command.PortIndex, command.Type);
                    break;

                case MakeConnectionCommand.Mode.Cancel:
                    activeStartPort = null;
                    break;
            }
        }
            /// <summary>
            /// Call this static method to reconstruct a RecordableCommand-derived
            /// object given an XmlElement that was previously saved with Serialize
            /// method. This method simply redirects the XmlElement to respective
            /// RecordableCommand-derived classes based on its type.
            /// </summary>
            /// <param name="element">The XmlElement from which the RecordableCommand
            /// can be reconstructed.</param>
            /// <returns>Returns the reconstructed RecordableCommand object. If a
            /// RecordableCommand cannot be reconstructed, this method throws a
            /// relevant exception.</returns>
            ///
            internal static RecordableCommand Deserialize(XmlElement element)
            {
                if (string.IsNullOrEmpty(element.Name))
                {
                    throw new ArgumentException("XmlElement without name");
                }

                RecordableCommand command = null;

                switch (element.Name)
                {
                case "OpenFileCommand":
                    command = OpenFileCommand.DeserializeCore(element);
                    break;

                case "PausePlaybackCommand":
                    command = PausePlaybackCommand.DeserializeCore(element);
                    break;

                case "RunCancelCommand":
                    command = RunCancelCommand.DeserializeCore(element);
                    break;

                case "CreateNodeCommand":
                    command = CreateNodeCommand.DeserializeCore(element);
                    break;

                case "SelectModelCommand":
                    command = SelectModelCommand.DeserializeCore(element);
                    break;

                case "CreateNoteCommand":
                    command = CreateNoteCommand.DeserializeCore(element);
                    break;

                case "SelectInRegionCommand":
                    command = SelectInRegionCommand.DeserializeCore(element);
                    break;

                case "DragSelectionCommand":
                    command = DragSelectionCommand.DeserializeCore(element);
                    break;

                case "MakeConnectionCommand":
                    command = MakeConnectionCommand.DeserializeCore(element);
                    break;

                case "DeleteModelCommand":
                    command = DeleteModelCommand.DeserializeCore(element);
                    break;

                case "UndoRedoCommand":
                    command = UndoRedoCommand.DeserializeCore(element);
                    break;

                case "ModelEventCommand":
                    command = ModelEventCommand.DeserializeCore(element);
                    break;

                case "UpdateModelValueCommand":
                    command = UpdateModelValueCommand.DeserializeCore(element);
                    break;

                case "ConvertNodesToCodeCommand":
                    command = ConvertNodesToCodeCommand.DeserializeCore(element);
                    break;

                case "CreateCustomNodeCommand":
                    command = CreateCustomNodeCommand.DeserializeCore(element);
                    break;

                case "SwitchTabCommand":
                    command = SwitchTabCommand.DeserializeCore(element);
                    break;
                }

                if (null != command)
                {
                    command.IsInPlaybackMode = true;
                    command.Tag = element.GetAttribute("Tag");
                    return(command);
                }

                string message = string.Format("Unknown command: {0}", element.Name);

                throw new ArgumentException(message);
            }