예제 #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();
                }
            }
        }
예제 #2
0
파일: Execute.cs 프로젝트: Gope/Apollo
        public static CommandExecutionConfiguration The(ICommand command)
        {
            var config = new CommandExecutionConfiguration { ExecutingCommand = command };
            if (command is AbstractCommand)
            {
                (command as AbstractCommand).ExecutionConfiguration = config;
            }

            return config;
        }
예제 #3
0
파일: Execute.cs 프로젝트: Gope/Apollo
        public static CommandExecutionConfiguration The(ICommand command)
        {
            var config = new CommandExecutionConfiguration {
                ExecutingCommand = command
            };

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

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

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

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

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

                RaiseCanUndoRedoChanged(this, EventArgs.Empty);
            });
        }
예제 #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();
                }
            }
        }