public void AddAction(ITrackingAction action) { lock (actionLocker) { LastActions.Insert(0, action); RevertedActions.Clear(); } }
public void AddAction(Func <ITrackingAction> action) { lock (actionLocker) { using (var logger = new TrackingLoggerScope(Logs, "Add")) { var newItem = action(); logger.Type = newItem.GetType().Name; LastActions.Insert(0, newItem); } RevertedActions.Clear(); } }
public void Remake() { lock (actionLocker) { var lastItem = RevertedActions.FirstOrDefault(); if (lastItem == null) { return; } using (var logger = new TrackingLoggerScope(Logs, "Remake", lastItem.GetType().Name)) lastItem.Apply(); RevertedActions.Remove(lastItem); LastActions.Insert(0, lastItem); } }