示例#1
0
        public void TrackCommand(ICommand command)
        {
            UndoStack.Push(command);
            RedoStack.Clear();
            var args = new UndoRedoEventArgs(UndoRedoAction.UndoPush | UndoRedoAction.RedoClear, command.DisplayText);

            UndoRedoChanged?.Invoke(this, args);
        }
示例#2
0
        public void Redo()
        {
            if (RedoStack.Count == 0)
            {
                return;
            }
            var command = RedoStack.Pop();

            command.Execute();
            UndoStack.Push(command);
            var args = new UndoRedoEventArgs(UndoRedoAction.RedoPop | UndoRedoAction.UndoPush, command.DisplayText);

            UndoRedoChanged?.Invoke(this, args);
        }
示例#3
0
 private void UpdateUndoRedo()
 {
     UndoRedoChanged.Raise(this);
 }
示例#4
0
        /// <summary>
        /// The undo redo changed.
        ///     React to change
        /// </summary>
        /// <param name="obj">
        /// The obj.
        /// </param>
        private void UndoRedoChanged(UndoRedoChanged obj)
        {
            if (obj == Infrastructure.Enums.UndoRedoChanged.UndoChanged)
            {
                this.CanUndo = this.undoRedo.CanUndo;
            }

            if (obj == Infrastructure.Enums.UndoRedoChanged.RedoChanged)
            {
                this.CanRedo = this.undoRedo.CanRedo;
            }
        }