void SendModelEventImpl(ModelEventCommand command)
 {
     foreach (var guid in command.ModelGuids)
     {
         CurrentWorkspace.SendModelEvent(guid, command.EventName, command.Value);
     }
 }
示例#2
0
        private void SendModelEventImpl(ModelEventCommand command)
        {
            CurrentSpace.SendModelEvent(command.ModelGuid, command.EventName);

            UndoCommand.RaiseCanExecuteChanged();
            RedoCommand.RaiseCanExecuteChanged();
        }
示例#3
0
        public void ModelEventCommand_Constructor()
        {
            //Arrange
            var cbn = CreateCodeBlockNode();
            IEnumerable <Guid> modelGuid   = new[] { cbn.GUID };
            XmlDocument        xmlDocument = new XmlDocument();

            //Act
            XmlElement elemTest             = xmlDocument.CreateElement("TestModelEventCommand");
            var        command1             = new ModelEventCommand(cbn.GUID, "testEvent1", 1);
            var        command2             = new ModelEventCommand(cbn.GUID, "testEvent2");
            var        command3             = new ModelEventCommand(modelGuid, "testEvent3");
            var        xmlSerializedCommand = command1.Serialize(xmlDocument);

            //Assert
            //This section validates that the commands were created correctly and the Serialization was successfull
            Assert.IsNotNull(command1);
            Assert.AreEqual(command1.EventName, "testEvent1");
            Assert.IsNotNull(command2);
            Assert.AreEqual(command2.EventName, "testEvent2");
            Assert.IsNotNull(command3);
            Assert.AreEqual(command3.EventName, "testEvent3");
            Assert.IsNotNull(xmlSerializedCommand);
        }
示例#4
0
 void SendModelEventImpl(ModelEventCommand command)
 {
     CurrentWorkspace.SendModelEvent(command.ModelGuid, command.EventName);
 }
示例#5
0
        private void SendModelEventImpl(ModelEventCommand command)
        {
            CurrentSpace.SendModelEvent(command.ModelGuid, command.EventName);

            UndoCommand.RaiseCanExecuteChanged();
            RedoCommand.RaiseCanExecuteChanged();
        }
示例#6
0
 void SendModelEventImpl(ModelEventCommand command)
 {
     foreach (var guid in command.ModelGuids)
     {
         CurrentWorkspace.SendModelEvent(guid, command.EventName);
     }
 }
示例#7
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 "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);
            }
示例#8
0
 void SendModelEventImpl(ModelEventCommand command)
 {
     CurrentWorkspace.SendModelEvent(command.ModelGuid, command.EventName);
 }