/// <summary> /// make timer procedure /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Timer_Elapsed(object sender, ElapsedEventArgs e) { try { Timer.Stop(); if (ServiceSettings == null) { SystemSettings = new SystemSettingsModel(); ServiceSettings = ServiceSettingHelper.InitServiceSettings(SystemSettings.SettingsPath); } ProcessorHelper.MakeProcessing(); Timer.Start(); } catch (Exception exception) { string innerException = exception.InnerException == null ? "" : exception.InnerException.Message; string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name; LogHelper.AddLog("Error in method: " + methodName + "; Exception: " + exception.Message + " Innner Exception: " + innerException); } }
/// <summary> /// start service method /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { try { Timer = new Timer(); Timer.Interval = 5000; Timer.Elapsed += Timer_Elapsed; SystemSettings = new SystemSettingsModel(); ServiceSettings = ServiceSettingHelper.InitServiceSettings(SystemSettings.SettingsPath); LogHelper.AddLog("Settings Path " + SystemSettings.SettingsPath); Timer.Start(); //ProcessorHelper.MakeProcessing(); LogHelper.AddLog("FCC Email Agent Service started"); } catch (Exception) { } }