Exemple #1
0
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
                this.automationSettings.RecordCommand(command);

            command.Execute(this);
        }
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);
            }
Exemple #3
0
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
            {
                this.automationSettings.RecordCommand(command);
            }

            command.Execute(this);
        }
Exemple #4
0
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
                this.automationSettings.RecordCommand(command);

            if (Model.DebugSettings.VerboseLogging)
                model.Logger.Log("Command: " + command);

            command.Execute(this);
        }
        public void ExecuteCommand(RecordableCommand command)
        {
            if (CommandStarting != null)
                CommandStarting(command);

            command.Execute(this);

            if (CommandCompleted != null)
                CommandCompleted(command);
        }
Exemple #6
0
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
                this.automationSettings.RecordCommand(command);

            if (dynSettings.Controller.DebugSettings.VerboseLogging)
                dynSettings.DynamoLogger.Log("Command: " + command);

            command.Execute(this);
        }
        public void ExecuteCommand(RecordableCommand command)
        {
            if (this.CommandStarting != null)
            {
                this.CommandStarting(command);
            }

            command.Execute(this);

            if (this.CommandCompleted != null)
            {
                this.CommandCompleted(command);
            }
        }
Exemple #8
0
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
            {
                this.automationSettings.RecordCommand(command);
            }

            if (Model.DebugSettings.VerboseLogging)
            {
                model.Logger.Log("Command: " + command);
            }

            command.Execute(this);
        }
        public void ExecuteCommand(RecordableCommand command)
        {
            if (null != this.automationSettings)
            {
                this.automationSettings.RecordCommand(command);
            }

            if (dynSettings.Controller.DebugSettings.VerboseLogging)
            {
                dynSettings.DynamoLogger.Log("Command: " + command);
            }

            command.Execute(this);
        }
Exemple #10
0
 public string ExecuteMessageFromSocket(string message, string sessionId)
 {
     try
     {
         dynSettings.Controller.SessionId = sessionId;
         RecordableCommand command = RecordableCommand.Deserialize(message);
         Application.Current.Dispatcher.Invoke(() => ExecuteCommand(command));
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     return(null);
 }
Exemple #11
0
            /// <summary>
            /// Call this static method to reconstruct a RecordableCommand from json
            /// string that contains command name - name of corresponding class inherited
            /// from RecordableCommand, - and all the arguments that are required by this
            /// command.
            /// </summary>
            /// <param name="jsonString">Json string that contains command name and all
            /// its arguments.</param>
            /// <returns>Reconstructed RecordableCommand</returns>
            internal static RecordableCommand Deserialize(string jsonString)
            {
                RecordableCommand command = null;

                try
                {
                    command = JsonConvert.DeserializeObject(jsonString, jsonSettings) as RecordableCommand;
                    command.IsInPlaybackMode = true;
                    return(command);
                }
                catch
                {
                    throw new ApplicationException("Invalid jsonString for creating RecordableCommand");
                }
            }
            /// <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);
            }