Пример #1
0
        public void Undo()
        {
            EndUndoCollection(); //just in case this wasn't called before

            if (undoStack.Count > 0)
            {
                var undoable = undoStack.Pop();
                var redoable = undoable.Revert(this);

                redoStack.Push(new RedoEntry {
                    undoable = undoable, redoable = redoable
                });
                Reverted?.Invoke(this, new RevertedEventArgs(redoable));
                ObjectsMoved?.Invoke(this, null);

                if (undoStack.Count == 0)
                {
                    IsSaved = LastSavedUndo == null;
                }
                else
                {
                    IsSaved = LastSavedUndo == undoStack.Peek();
                }
            }
        }
Пример #2
0
        public void Redo()
        {
            if (redoStack.Count > 0)
            {
                var entry = redoStack.Pop();

                entry.redoable.Revert(this);

                undoStack.Push(entry.undoable);
                Reverted?.Invoke(this, new RevertedEventArgs(entry.undoable));
                ObjectsMoved?.Invoke(this, null);

                IsSaved = undoStack.Peek() == LastSavedUndo;
            }
        }
Пример #3
0
 /// <summary>
 /// Restores <see cref="Value"/> to <see cref="DefaultValue"/>.
 /// </summary>
 public void Revert()
 {
     Value = defaultValue;
     Reverted?.Invoke(value);
 }
Пример #4
0
 public void Revert()
 {
     data = def;
     Reverted?.Invoke(def);
 }