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"); }
public void StartWatcher() { Logger.Trace("StartWatcher called for {BasePath}", BasePath); RegistryDisableService.StartWatcher(); if (monitor != null) { Logger.Trace("Watcher already started"); return; } monitor = new FolderChangeMonitor() { BasePath = BasePath, Category = Category, }; monitor.Add += AddHandler; monitor.Remove += RemoveHandler; Logger.Trace("Watcher started"); }