public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace) { CompoundHistoryMemento chm = new CompoundHistoryMemento(this.historyName, this.undoImage); if (!historyWorkspace.Selection.IsEmpty) { DeselectFunction df = new DeselectFunction(); EnterCriticalRegion(); HistoryMemento hm = df.Execute(historyWorkspace); chm.PushNewAction(hm); } FlipLayerHistoryMemento flha = new FlipLayerHistoryMemento( null, null, historyWorkspace, this.layerIndex, this.flipType); EnterCriticalRegion(); HistoryMemento flha2 = flha.PerformUndo(); chm.PushNewAction(flha); return chm; }
public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace) { List<HistoryMemento> actions = new List<HistoryMemento>(); if (!historyWorkspace.Selection.IsEmpty) { DeselectFunction da = new DeselectFunction(); EnterCriticalRegion(); HistoryMemento hm = da.Execute(historyWorkspace); actions.Add(hm); } int count = historyWorkspace.Document.Layers.Count; for (int i = 0; i < count; ++i) { HistoryMemento memento = new FlipLayerHistoryMemento(this.historyName, undoImage, historyWorkspace, i, flipType); EnterCriticalRegion(); HistoryMemento mementoToAdd = memento.PerformUndo(); actions.Add(mementoToAdd); } return new CompoundHistoryMemento(this.historyName, undoImage, actions); }