1
hutongqing
2025-01-02 8c6fd742db249ad4cc819cf041eb98d880a3ef73
WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzExtensions/QuartzJobHostedService.cs
@@ -34,6 +34,9 @@
namespace WIDESEAWCS_QuartzJob.QuartzExtensions
{
    /// <summary>
    /// 启动程序自动开启调度服务
    /// </summary>
    public class QuartzJobHostedService : IHostedService
    {
        private readonly ISchedulerCenter _schedulerCenter;
@@ -43,6 +46,9 @@
        private readonly IDeviceProtocolDetailService _deviceProtocolDetailService;
        private readonly QuartzNetExtension _quartzNetExtension;
        /// <summary>
        /// 启动程序自动开启调度服务
        /// </summary>
        public QuartzJobHostedService(ILogger<QuartzJobHostedService> logger, IDeviceInfoService deviceInfoService, IDispatchInfoService dispatchInfoService, ISchedulerCenter schedulerCenter, IDeviceProtocolDetailService deviceProtocolDetailService, QuartzNetExtension quartzNetExtension)
        {
            _logger = logger;
@@ -60,15 +66,12 @@
        /// <returns></returns>
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            if (!HslCommunication.Authorization.SetAuthorizationCode("891c8f18-d6de-409f-81f4-6de405431905"))
            {
                Console.WriteLine("active failed");
                Console.ReadLine();
            }
            await _quartzNetExtension.StartAsync();
        }
        /// <summary>
        /// 启动程序自动开启调度服务
        /// </summary>
        public Task StopAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Stop QuartzJob Service!");