Esempio n. 1
0
        private void Execute(CommandExecutionConfiguration config)
        {
            config.ExecutingCommand.EventAggregator = EventAggregator;
            var abstractCommand = config.ExecutingCommand as AbstractCommand;

            if (abstractCommand != null)
            {
                abstractCommand.CommandManager         = this;
                abstractCommand.SynchronizationContext = this.syncContext;
            }

            if (config.Callback != null)
            {
                config.ExecutingCommand.CompletedHandler = config.Callback;
            }

            // choose wether to record the command or just fire it.
            if (config.RecordCommandWithHistoryForUndoRedo)
            {
                RecordCommand(config.ExecutingCommand as AbstractCommand);
            }
            else if (config.ExecutingCommand.CanExecute())
            {
                if (config.RunInBackground)
                {
                    this.ExecuteInSpawnedThread(config.ExecutingCommand as AbstractCommand);
                }
                else
                {
                    config.ExecutingCommand.Execute();
                }
            }
        }
Esempio n. 2
0
        public static CommandExecutionConfiguration The(ICommand command)
        {
            var config = new CommandExecutionConfiguration { ExecutingCommand = command };
            if (command is AbstractCommand)
            {
                (command as AbstractCommand).ExecutionConfiguration = config;
            }

            return config;
        }
Esempio n. 3
0
        public static CommandExecutionConfiguration The(ICommand command)
        {
            var config = new CommandExecutionConfiguration {
                ExecutingCommand = command
            };

            if (command is AbstractCommand)
            {
                (command as AbstractCommand).ExecutionConfiguration = config;
            }

            return(config);
        }
Esempio n. 4
0
        public void Do(CommandExecutionConfiguration configuration)
        {
            RunCommandTillEndWith(() =>
            {
                RedoStack.Clear();

                Execute(configuration);
                if (autocommit)
                {
                    this.CommitTransaction();
                }

                RaiseCanUndoRedoChanged(this, EventArgs.Empty);
            });
        }
Esempio n. 5
0
        public void Do(CommandExecutionConfiguration configuration)
        {
            RunCommandTillEndWith(() =>
            {
                RedoStack.Clear();

                Execute(configuration);
                if (autocommit)
                {
                    this.CommitTransaction();
                }

                RaiseCanUndoRedoChanged(this, EventArgs.Empty);
            });
        }
Esempio n. 6
0
        private void Execute(CommandExecutionConfiguration config)
        {
            config.ExecutingCommand.EventAggregator = EventAggregator;
            var abstractCommand = config.ExecutingCommand as AbstractCommand;
            if (abstractCommand != null)
            {
                abstractCommand.CommandManager = this;
                abstractCommand.SynchronizationContext = this.syncContext;
            }

            if (config.Callback != null)
            {
                config.ExecutingCommand.CompletedHandler = config.Callback;
            }

            // choose wether to record the command or just fire it.
            if (config.RecordCommandWithHistoryForUndoRedo)
            {
                RecordCommand(config.ExecutingCommand as AbstractCommand);
            }
            else if (config.ExecutingCommand.CanExecute())
            {
                if (config.RunInBackground)
                {
                    this.ExecuteInSpawnedThread(config.ExecutingCommand as AbstractCommand);
                }
                else
                {
                    config.ExecutingCommand.Execute();
                }
            }
        }