using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using Mall.WindowsService.Helper;
namespace Mall.WindowsService
{
    partial class WindowsService : ServiceBase
    {
        System.Timers.Timer timer1;  //计时器

        public WindowsService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            // TODO: 在此处添加代码以启动服务。
            LogHelper.Write("主服务开始运行......");
            TimersHelper helper = new TimersHelper();
            timer1 = new System.Timers.Timer();
            timer1.Interval = 1000 * (60 * 0.5); //60分钟
            timer1.Elapsed += new System.Timers.ElapsedEventHandler(helper.RevenueFinance);
            timer1.Enabled = true;
        }

        protected override void OnStop()
        {
            // TODO: 在此处添加代码以执行停止服务所需的关闭操作。
            LogHelper.Write("主服务停止运行......");
            this.timer1.Enabled = false;
        }
    }
}
