public void StopWatcher() { Logger.Trace("StopWatcher called for {BasePath}", BasePath); RegistryDisableService?.StopWatcher(); if (monitor == null) { Logger.Trace("No watcher running"); return; } monitor.Changed -= ChangeHandler; monitor.Error -= ErrorHandler; monitor.Stop(); monitor.Dispose(); monitor = null; Logger.Trace("Stopped watcher"); }
public void StopWatcher() { Logger.Trace("StopWatcher called for {BasePath}", BasePath); RegistryDisableService.StopWatcher(); if (monitor == null) { Logger.Trace("No watcher running"); return; } monitor.Add -= AddHandler; monitor.Remove -= RemoveHandler; monitor.Stop(); monitor.Dispose(); monitor = null; Logger.Trace("Watcher stopped"); }