public SmartWatcherService() { InitializeComponent(); #if DEBUG //Launches and attaches a debugger to the process. Remove it for production System.Diagnostics.Debugger.Launch(); ServiceLogger.LogDebug("Start Debugging."); #endif // intilaize files processor to maintains files queue processor = new FileProcessor(); LoadPlugIns(); RegisterWatchers(); _smartTimer = new SmartTimer(_interval); _smartTimer.EventSmartTimerTick += smartTimer_EventSmartTimerTick; if (_enableTimer) { ServiceLogger.LogInfo("Start: SmartTimer"); _smartTimer.StartTimer(); } }
protected override void OnStop() { ServiceLogger.LogInfo("SmartWatcher service stopping."); if (_smartTimer != null) { _smartTimer.StopTimer(); _smartTimer = null; } }