/** * Overridden to preserve usual semantics: returns true if an undo * operation would be successful now, false otherwise */ public override bool CanUndo() { if (inProgress) { IUndoableEdit edit = EditToBeUndone(); return(edit != null && edit.CanUndo()); } else { return(base.CanUndo()); } }
public override bool CanUndo() { lock (this) { if (IsInProgress()) { IUndoableEdit e = EditToBeUndone(); return(e != null && e.CanUndo()); } else { return(base.CanUndo()); } } }
/// <summary> /// This predicate is true when one can call <see cref="Undo"/>. /// </summary> /// <returns></returns> /// <remarks> /// In order to be able to perform an undo, a transaction must not /// be in progress, nor an undo or a redo. /// Furthermore there must be an <see cref="EditToUndo"/> that itself /// is ready to be undone, because its <see cref="IUndoableEdit.CanUndo"/> /// predicate is true. /// </remarks> /// <seealso cref="Undo"/> public virtual bool CanUndo() { if (this.TransactionLevel > 0) { return(false); } if (this.IsUndoingRedoing) { return(false); } IUndoableEdit curr = this.EditToUndo; return(curr != null && curr.CanUndo()); }
public virtual bool CanUndo() { if (this.TransactionLevel <= 0) { if (this.IsUndoing) { return(false); } if (this.IsRedoing) { return(false); } IUndoableEdit edit1 = this.EditToUndo; if (edit1 != null) { return(edit1.CanUndo()); } } return(false); }