protected override void OnStart(string[] args) { SLog.WriteLog("===================================================="); try { #region 根据消息发送类型配置启动时钟 tmMail.Enabled = false; if (MsgSentTypes.Contains(type_Mail)) { tmMail.Enabled = true; tmMail.Start(); } #endregion } catch (Exception ex) { SLog.WriteLogWithDefaultTime(string.Format("服务启动失败,详细:{0}", ex.Message)); } SLog.WriteLogWithDefaultTime("服务正常启动。"); }
/// <summary> /// 初始化时钟 /// </summary> private void InitializeTimers() { try { tmMail.Interval = Convert.ToDouble(interval_Mail); SLog.WriteLog(string.Format("服务时钟时间间隔初始化:邮件服务{0}.单位:秒/一次。", tmMail.Interval / 1000)); } catch (Exception ex) { SLog.WriteLogWithDefaultTime(ex.Message); } }
protected override void OnStop() { SLog.WriteLogWithDefaultTime("服务关闭。"); SLog.WriteLog("===================================================="); }