public void Execute() { if (!_action.CanExecute()) { return; } _action.ExecuteDo(); _undoableActions.Push(_action); _redoableActions.Clear(); }
/// <summary> /// Redo the last undone action. /// </summary> public void Redo() { if (_redoableActions.Count <= 0) { return; } IUndoable action = _redoableActions.Pop(); action.ExecuteDo(); _undoableActions.Push(action); _saveLoadManager.Unsaved = true; }
/// <summary> /// Executes a specified action and adds it to the stack of undoable actions. /// </summary> /// <param name="action"> /// The action to be executed. /// </param> public void NewAction(IUndoable action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } if (!action.CanExecute()) { return; } action.ExecuteDo(); _undoableActions.Push(action); _redoableActions.Clear(); _saveLoadManager.Unsaved = true; }
public void Execute() { _undoableActions.Push(_action); _action.ExecuteDo(); }