You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
958 B
C#

11 months ago
using Admin.Core.Common;
using Admin.Core.RunPlc;
using log4net;
using Microsoft.AspNetCore.Builder;
using System;
namespace Admin.Core.Extensions
{
/// <summary>
///PLC
/// </summary>
public static class PlcMildd
{
private static readonly ILog log = LogManager.GetLogger(typeof(PlcMildd));
public static async void UsePlcMildd(this IApplicationBuilder app, IRunPlcService plc)
{
if (app == null) throw new ArgumentNullException(nameof(app));
try
{
if (Appsettings.app("Middleware", "Plc", "Enabled").ObjToBool())
{
await plc.StartPlcAsync();
8 months ago
await plc.StartAlarmAsync();
11 months ago
}
}
catch (Exception e)
{
log.Error($"An error was reported when starting the job service.\n{e.Message}");
throw;
}
}
}
}