protected override HistoryMemento OnUndo() { DeleteLayerHistoryMemento ha = new DeleteLayerHistoryMemento(Name, Image, this.historyWorkspace, (Layer)this.historyWorkspace.Document.Layers[layerIndex]); ha.ID = this.ID; this.historyWorkspace.Document.Layers.RemoveAt(layerIndex); this.historyWorkspace.Document.Invalidate(); return ha; }
protected override HistoryMemento OnUndo() { DeleteLayerHistoryMemento ha = new DeleteLayerHistoryMemento(Name, Image, this.historyWorkspace, (Layer)this.historyWorkspace.Document.Layers[layerIndex]); ha.ID = this.ID; this.historyWorkspace.Document.Layers.RemoveAt(layerIndex); this.historyWorkspace.Document.Invalidate(); return(ha); }
protected override HistoryMemento OnUndo(ProgressEventHandler progressCallback) { DeleteLayerHistoryMemento memento = new DeleteLayerHistoryMemento(base.Name, base.Image, this.historyWorkspace, (Layer)this.historyWorkspace.Document.Layers[this.layerIndex]) { ID = base.ID }; this.historyWorkspace.Document.Layers.RemoveAt(this.layerIndex); this.historyWorkspace.Document.Invalidate(); return(memento); }
public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace) { if (this.layerIndex < 0 || this.layerIndex >= historyWorkspace.Document.Layers.Count) { throw new ArgumentOutOfRangeException("layerIndex = " + this.layerIndex + ", expected [0, " + historyWorkspace.Document.Layers.Count + ")"); } HistoryMemento hm = new DeleteLayerHistoryMemento(StaticName, StaticImage, historyWorkspace, historyWorkspace.Document.Layers.GetAt(this.layerIndex)); EnterCriticalRegion(); historyWorkspace.Document.Layers.RemoveAt(this.layerIndex); return hm; }