using Mall.Education.Models;
using Mall.Education.RabbitMQ;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace Mall.Education
{
    partial class EducationToImageServer : ServiceBase
    {
        public EducationToImageServer()
        {
            InitializeComponent();
        }

        /// <summary>
        ///  在此处添加代码以启动服务。
        /// </summary>
        /// <param name="args"></param>
        protected override void OnStart(string[] args)
        {
            //清理临时文件
            new QuarzHelper().StartDelTemporaryFile().GetAwaiter().GetResult();

            //消息队列处理word转图片
            RabbitConfig rabbit = new RabbitConfig()
            {
                HostName = "47.96.25.130",
                Port = 5672,
                UserName = "guest",
                Password = "viitto2019",
                QueenName = RabbitKey.QUEEN_GENERATE_EDUCARION
            };
            Task.Factory.StartNew(() => RabbiMQManager.DealWithMessage(rabbit));
        }

        /// <summary>
        /// 在此处添加代码以执行停止服务所需的关闭操作。
        /// </summary>
        protected override void OnStop()
        {
        }
    }
}
