public void AddAndExecute(IUndoRedoCommand command)
 {
     _undoStack.Push(command);
     _redoStack.Clear();
     command.Execute();
     UpdateCommandStatus();
 }
コード例 #2
0
        /// <inheritdoc/>
        public void AddAndExecute(IUndoRedoCommand command, bool ignoreRedundant = true)
        {
            if (ignoreRedundant && command.IsRedundant)
            {
                return;
            }

            if (this.commands.Count == 0)
            {
                this.commands.Add(command);
                this.commandIndex = 0;
            }
            else
            {
                if (this.direction == Direction.Reverse)
                {
                    this.commands[this.commandIndex] = command;
                    this.RemoveCommandsAfterCurrentIndex();
                }
                else
                {
                    this.RemoveCommandsAfterCurrentIndex();
                    this.commands.Add(command);
                    this.commandIndex = this.commands.Count - 1;
                }
            }

            command.Execute();
            this.direction = Direction.Forward;
        }
        public void Redo()
        {
            IUndoRedoCommand command = _redoStack.Pop();

            _undoStack.Push(command);
            command.Execute();
            UpdateCommandStatus();
        }
コード例 #4
0
        /// <summary>
        /// Redoes an action
        /// </summary>
        public void Redo()
        {
            IUndoRedoCommand cmd = RedoList.Last();

            cmd.Execute();
            RedoList.Remove(cmd);
            UndoList.Add(cmd);
        }
コード例 #5
0
 public void Redo()
 {
     if (redoStack.Any())
     {
         IUndoRedoCommand command = redoStack.Pop();
         undoStack.Push(command);
         command.Execute();
     }
 }
コード例 #6
0
ファイル: UndoRedo.cs プロジェクト: Neeeeena/WinProG24
 public void InsertInUndoRedo(IUndoRedoCommand command)
 {
     _undoCommands.Push(command);
     _redoCommands.Clear();
     command.Execute();
     EnableUndo = CanUndo(1);
     RaisePropertyChanged(nameof(EnableUndo));
     RaisePropertyChanged(nameof(EnableRedo));
 }
コード例 #7
0
ファイル: UndoRedoManager.cs プロジェクト: Roemer/FlauLib
 /// <summary>
 /// Executes the action and pushes it to the appropriate stack
 /// </summary>
 public void Execute(IUndoRedoCommand command)
 {
     lock (_lockObject)
     {
         _executeInProgress = true;
         command.Execute();
         Push(command);
         _executeInProgress = false;
     }
 }
コード例 #8
0
ファイル: UndoRedoController.cs プロジェクト: neroes/AI-MAS
 // Bruges til at tilføje commander.
 public void AddAndExecute(IUndoRedoCommand command)
 {
     undoStack.AddFirst(command);
     if (undoStack.Count == 50)
     {
         undoStack.RemoveLast();
     }
     redoStack.Clear();
     command.Execute();
 }
コード例 #9
0
 public void AddAndExecute(IUndoRedoCommand command)
 {
     _undoStack.Push(command);
     _redoStack.Clear();
     command.Execute();
     UpdateCommandStatus();
     foreach (var v in _undoStack)
     {
         Console.WriteLine(v.ToString());
     }
 }
コード例 #10
0
ファイル: Document.cs プロジェクト: Win10Mindapp/Mindmap
 public void Apply(IUndoRedoCommand command)
 {
     if (IsChangeTracking)
     {
         transaction.Add(command);
     }
     else
     {
         command.Execute();
     }
 }
コード例 #11
0
        // Udfører redo hvis det kan lade sig gøre.
        public void Redo()
        {
            if (redoStack.Count() <= 0)
            {
                throw new InvalidOperationException();
            }
            IUndoRedoCommand command = redoStack.Pop();

            undoStack.Push(command);
            command.Execute();
        }
コード例 #12
0
 // Bruges til at tilføje commander.
 public void AddAndExecute(IUndoRedoCommand command)
 {
     if (undoList.Count > 10)
     {
         undoList.RemoveLast();
     }
     undoList.AddFirst(command);
     redoList.Clear();
     //Trace.Write("Command was pushed to undostack: " + command.ToString() + "\n");
     undoStack.Push(command);
     redoStack.Clear();
     command.Execute();
 }
コード例 #13
0
ファイル: UndoRedoStack.cs プロジェクト: niraida/blank-filler
        /// <summary>
        /// Выполняет новую команду
        /// </summary>
        /// <param name="command">команда</param>
        public void ExecuteNewCommand(IUndoRedoCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            if (UndoedCommands.Any())
            {
                UndoedCommands.Clear();
            }

            Commands.Add(command);
            command.Execute();
        }
コード例 #14
0
ファイル: UndoRedoController.cs プロジェクト: neroes/AI-MAS
        // Udfører redo hvis det kan lade sig gøre.
        public void Redo()
        {
            if (redoStack.Count() <= 0)
            {
                throw new InvalidOperationException();
            }
            IUndoRedoCommand command = redoStack.First();

            undoStack.AddFirst(command);
            command.Execute();

            if (redoStack.Any())
            {
                redoStack.RemoveFirst();
            }
        }
コード例 #15
0
 // Used for adding the Undo/Redo command to the 'undoStack' and at the same time executing it.
 public void AddAndExecute(IUndoRedoCommand command)
 {
     undoStack.Push(command);
     redoStack.Clear();
     command.Execute();
 }
コード例 #16
0
 public void AddAndExecute(IUndoRedoCommand command)
 {
     undoStack.Push(command);
     redoStack.Clear();
     command.Execute();
 }
コード例 #17
0
ファイル: UndoRedo.cs プロジェクト: Neeeeena/WinProG24
 public void InsertInUndoRedo(IUndoRedoCommand command)
 {
     _undoCommands.Push(command);
     _redoCommands.Clear();
     command.Execute();
     EnableUndo = CanUndo(1);
     RaisePropertyChanged(nameof(EnableUndo));
     RaisePropertyChanged(nameof(EnableRedo));
     Messenger.Default.Send(new UndoRedoEnabledMsg(true,false));
 }