public void Add(ISnapshot snapshot) { Argument.IsNotNull(() => snapshot); if (!_snapshots.Contains(snapshot)) { Log.Debug($"[{Scope}] Adding snapshot '{snapshot}'"); _snapshots.Add(snapshot); SnapshotAdded?.Invoke(this, new SnapshotEventArgs(snapshot)); SnapshotsChanged?.Invoke(this, EventArgs.Empty); } }
public bool Remove(ISnapshot snapshot) { Argument.IsNotNull(() => snapshot); Log.Debug($"[{Scope}] Deleting snapshot '{snapshot}'"); if (!_snapshots.Contains(snapshot)) { Log.Debug($"[{Scope}] Can't delete snapshot '{snapshot}', snapshot is not managed by the manager"); return(false); } var removed = _snapshots.Remove(snapshot); if (removed) { SnapshotRemoved?.Invoke(this, new SnapshotEventArgs(snapshot)); SnapshotsChanged?.Invoke(this, EventArgs.Empty); } return(removed); }