示例#1
0
        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.");
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
        }