namespace IBox.WinFrmUI { /// /// 监测记录 /// public class MonitorRecord { /// /// /// public MonitorRecord() { } /// /// /// public MonitorRecord(MonitorRecord rhs) { this.SignalID = rhs.SignalID; this.DataTime = rhs.DataTime; this.DataValue = rhs.DataValue; this.DataStatus = rhs.DataStatus?.ToList(); } public string ToString() { return $"{DataTime.ToString("yyyy-MM-dd HH:mm:ss")};{DataValue};{1}"; } public MonitorRealRecord FromString(string str) { MonitorRealRecord ret = new MonitorRealRecord(); if (!string.IsNullOrEmpty(str)) { var sp = str.Split(';'); if (sp.Length > 0 && !string.IsNullOrEmpty(sp[0])) { ret.DataTime = DateTime.Parse(sp[0]); } if (sp.Length > 1 && !string.IsNullOrEmpty(sp[1])) ret.DataValue = sp[1]; //if (sp.Length > 2 && !string.IsNullOrEmpty(sp[2])) //ret.DataStatus = DataStatusHelper.ToList(sp[2]); } return ret; } /// /// 信号id /// public long SignalID { get; set; } /// /// 数据时间 /// public DateTime DataTime { get; set; } /// /// 数据值 /// public string DataValue { get; set; } /// /// 数据状态 /// public List DataStatus { get; set; } } }