private void RollbackEvent(BaseEvent @event, bool undoing) { ExecuteNoTrack(() => { var reverse = @event.Rollback(); if (reverse == null) return; if (reverse is BatchEvent) { if (!(@event is BatchEvent)) throw new InvalidOperationException("Must not return BatchEvent in Rollback()"); reverse = ProcessBatch((BatchEvent) reverse); if (reverse == null) return; } (undoing ? _redoStack : _undoStack).Push(reverse); }); }
private void PerformPostMarkAction(BaseEvent @event) { _redoStack.Clear(); NotifyChange(@event); }
/// <summary> /// Marks an event. This method also serves as an extensibility point for custom events. /// </summary> /// <param name="anEvent">The event to be marked.</param> public void MarkEvent(BaseEvent anEvent) { if (!IsTrackingEnabled) return; if (anEvent == null) throw new ArgumentNullException("anEvent"); (_currentBatch ?? _undoStack).Push(anEvent); if (!IsInBatch) PerformPostMarkAction(anEvent); }
private void NotifyChange(BaseEvent @event) { if (Changed != null) Changed(this, new MementorChangedEventArgs {Event = @event}); }
private void PerformPostMarkAction(BaseEvent @event) { _redoStack.Clear(); NotifyChange(@event); }