namespace PaintDotNet.Measurement.HistoryMementos { public class LayerPropertyHistoryMemento : HistoryMemento { private object properties; private IDocumentWorkspace historyWorkspace; private int layerIndex; protected override HistoryMemento OnUndo() { HistoryMemento ha = new LayerPropertyHistoryMemento(Name, Image, this.historyWorkspace, this.layerIndex); Layer layer = (Layer)this.historyWorkspace.GetDocument().Layers[layerIndex]; layer.LoadProperties(properties, true); layer.PerformPropertyChanged(); return ha; } public LayerPropertyHistoryMemento(string name, ImageResource image, IDocumentWorkspace historyWorkspace, int layerIndex) : base(name, image) { this.historyWorkspace = historyWorkspace; this.layerIndex = layerIndex; this.properties = ((Layer)this.historyWorkspace.GetDocument().Layers[layerIndex]).SaveProperties(); } } }