public void AddProvider(ISnapshotProvider snapshotProvider) { Argument.IsNotNull(() => snapshotProvider); #if DEBUG Log.Debug($"[{Scope}] Adding provider {snapshotProvider.GetType()} to the SnapshotManager (Scope = '{Scope ?? "null"}')"); #endif lock (_providers) { _providers.Add(snapshotProvider); } SnapshotProviderAdded.SafeInvoke(this, new SnapshotProviderEventArgs(snapshotProvider)); }
public bool RemoveProvider(ISnapshotProvider snapshotProvider) { Argument.IsNotNull(() => snapshotProvider); #if DEBUG Log.Debug($"[{Scope}] Removing provider {snapshotProvider.GetType()} from the SnapshotManager (Tag == \"{Scope ?? "null"}\")"); #endif var removed = false; lock (_providers) { removed = _providers.Remove(snapshotProvider); } if (removed) { SnapshotProviderRemoved.SafeInvoke(this, new SnapshotProviderEventArgs(snapshotProvider)); return(true); } return(false); }