コード例 #1
0
        public void Add(ISnapshot snapshot)
        {
            Argument.IsNotNull(() => snapshot);

            if (!_snapshots.Contains(snapshot))
            {
                Log.Debug($"[{Scope}] Adding snapshot '{snapshot}'");

                _snapshots.Add(snapshot);

                SnapshotAdded.SafeInvoke(this, () => new SnapshotEventArgs(snapshot));
                SnapshotsChanged.SafeInvoke(this);
            }
        }
コード例 #2
0
        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.SafeInvoke(this, () => new SnapshotEventArgs(snapshot));
                SnapshotsChanged.SafeInvoke(this);
            }

            return(removed);
        }