public void RedoOne(object[] actors) { this.VerifyWriterLock(); try { for (int i = this.m_RedoStack.Count; --i >= 0;) { if (!ActorsMatch(actors, ((IUndoer)this.m_RedoStack[i]).Actors)) { continue; } IUndoer undoer = ((IUndoer)this.m_RedoStack[i]); this.m_RedoStack.RemoveAt(i); try { undoer.Redo(); } catch { ClearStack(this.m_RedoStack, actors); throw; } this.m_UndoStack.Add(undoer); return; } } finally { if (this.Update != null) { this.Update(this, EventArgs.Empty); } } throw new InvalidOperationException("Cannot undo unless IsUndoable returns true."); }
public void Push(IUndoer undoer) { this.VerifyWriterLock(); this.m_UndoStack.Add(undoer); // If action A is undone, and action B is performed, then action A is no longer valid. ClearStack(this.m_RedoStack, undoer.Actors); if (this.Update != null) { this.Update(this, EventArgs.Empty); } }
public void Push(IUndoer undoer) { this.VerifyWriterLock(); this.m_UndoStack.Add(undoer); // If action A is undone, and action B is performed, then action A is no longer valid. ClearStack(this.m_RedoStack, undoer.Actors); if(this.Update != null) this.Update(this, EventArgs.Empty); }