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.
AUCMA_SCADA/Aucma.Core.Tasks/AucamTaskService.cs

67 lines
2.7 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Admin.Core.Common;
using Aucma.Core.PLc;
using log4net;
using System.Timers;
namespace Aucma.Core.Tasks
{
/// <summary>
/// 实时任务列表
/// </summary>
public class AucamTaskService : IAucamTaskService
{
//private static readonly log4net.ILog log = LogManager.GetLogger(typeof(AucamTaskService));
System.Timers.Timer timer1 = new System.Timers.Timer(1000);
System.Timers.Timer timer2 = new System.Timers.Timer(1000);
System.Timers.Timer timer3 = new System.Timers.Timer(1000);
public Task AucamTaskAsync()
{
timer1.Elapsed += new System.Timers.ElapsedEventHandler(Run1); //到达时间的时候执行事件;
timer1.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer1.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer1.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
timer2.Elapsed += new System.Timers.ElapsedEventHandler(Run2); //到达时间的时候执行事件;
timer2.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer2.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer2.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
timer3.Elapsed += new System.Timers.ElapsedEventHandler(Run3); //到达时间的时候执行事件;
timer3.AutoReset = true;//设置是执行一次false还是一直执行(true)
timer3.Enabled = true;//需要调用 timer.Start()或者timer.Enabled = true来启动它
timer3.Start();//timer.Start()的内部原理还是设置timer.Enabled = true;
return Task.CompletedTask;
}
/// <summary>
/// 钣金——前板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run1(object? sender, ElapsedEventArgs e)
{
Console.WriteLine("前板");
}
/// <summary>
/// 钣金——后板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run2(object? sender, ElapsedEventArgs e)
{
Console.WriteLine("后板");
}
/// <summary>
/// 钣金——实时任务列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run3(object? sender, ElapsedEventArgs e)
{
Console.WriteLine("实时任务列表");
}
}
}