/// <summary> /// Performs an undo action. /// </summary> /// <returns> /// Returns true if the undo action succeeds; otherwise, returns false. /// </returns> public bool Undo() { bool flag = true; if (AllowUndo && CanUndo) { IUndo undo = UndoList.Peek() as IUndo; try { if ((undo != null) && undo.CanUndo) { flag = undo.Undo(Context); } } catch { flag = false; } if (Context is Excel excel) { excel.ResumeInvalidate(); } if (flag) { RedoList.Push(UndoList.Pop()); RaiseChanged(UndoRedoOperation.Undo, undo.ToString()); } } return(flag); }
public bool Undo() { if (UndoSize == 0) { return(false); } var action = UndoList.Pop(); action.PerformRevertAction(); RedoList.Push(action); return(true); }
public void Undo() { if (CanUndo == false) { return; } RedoList.Push(_value); _value = UndoList.Pop(); OnPropertyChanged("Value"); OnPropertyChanged("CanUndo"); OnPropertyChanged("CanRedo"); }