예제 #1
0
        protected override HistoryMemento OnUndo(ProgressEventHandler progressCallback)
        {
            List <HistoryMemento> actions = new List <HistoryMemento>(this.mementos.Count);

            for (int i = 0; i < this.mementos.Count; i++)
            {
                HistoryMemento memento2 = this.mementos[(this.mementos.Count - i) - 1];
                HistoryMemento item     = null;
                if (memento2 != null)
                {
                    item = memento2.PerformUndo(progressCallback);
                }
                actions.Add(item);
            }
            return(new CompoundHistoryMemento(base.Name, base.Image, actions));
        }
        protected override HistoryMemento OnUndo()
        {
            List <HistoryMemento> redoActions = new List <HistoryMemento>(actions.Count);

            for (int i = 0; i < actions.Count; ++i)
            {
                HistoryMemento ha  = actions[actions.Count - i - 1];
                HistoryMemento rha = null;

                if (ha != null)
                {
                    rha = ha.PerformUndo();
                }

                redoActions.Add(rha);
            }

            CompoundHistoryMemento cha = new CompoundHistoryMemento(Name, Image, redoActions);

            return(cha);
        }