using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.Models
{
///
/// Kp表单步跟踪其运行时间跟踪信息
///
public class MeterRunTime
{
public delegate void RunTimeCallSglDelegate(string ProName, string MeterName, int MeterStep);
public event RunTimeCallSglDelegate RunTimeCallSglEvent;
///
/// 是否启用
///
public bool RunEnable { get; set; } = false;
///
/// 当前仪表名称
///
public string MeterName { get; set; }
///
/// 当前程序段名称
///
public string ProName { get; set; }
///
/// 当前仪表程序步骤
///
public int MeterStep { get; set; }
///
/// 当前步骤开始运行时间
///
public DateTime StartDateTime { get; set; }
///
/// 当前步骤结束运行时间
///
public DateTime EndDateTime { get; set; }
private DateTime currentDateTime;
///
/// 当前时间
///
public DateTime CurrentDateTime
{
get
{
return currentDateTime;
}
set
{
if (RunEnable == true && value.ToString("yyyy-MM-dd HH:mm:ss") == EndDateTime.ToString("yyyy-MM-dd HH:mm:ss"))
{
currentDateTime = value;
//时间到了触发下载新的步骤
RunTimeCallSglEvent(ProName, MeterName, MeterStep);
//RunEnable = false;
}
else
{
currentDateTime = value;
RunTime = (int)(currentDateTime - StartDateTime).TotalSeconds;
}
}
}
///
/// 当前步骤已经运行时长-秒
///
public int RunTime { get; set; }
}
}