private void Do(DuplicateAction action) { action.Do(); if (action.Successful) { model.DoneActions.Push(action); } model.UndoneActions.Clear(); model.NotifyPropertyChanged(nameof(model.EnableRedoButton)); model.NotifyPropertyChanged(nameof(model.EnableUndoButton)); }
/// <summary> /// Pop an action from the undoneActions stack and executes it. Returns false if there was no action on the stack to redo. /// </summary> public bool Redo() { bool ret = false; if (model.UndoneActions.Count > 0) { DuplicateAction action = model.UndoneActions.Pop(); action.Do(); if (action.Successful) { model.DoneActions.Push(action); } model.UndoneActions.Clear(); ret = true; } model.NotifyPropertyChanged(nameof(model.EnableRedoButton)); model.NotifyPropertyChanged(nameof(model.EnableUndoButton)); return(ret); }