70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
using Remontor.Connector;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace Remontor.History
|
|
{
|
|
|
|
[Serializable]
|
|
internal class HistoryItem
|
|
{
|
|
private IComp comp;
|
|
private DateTime startTime;
|
|
private string statusName;
|
|
|
|
public HistoryItem(IComp comp, DateTime startTime)
|
|
{
|
|
this.comp = comp;
|
|
this.startTime = startTime;
|
|
}
|
|
|
|
public HistoryItem(Connect connect)
|
|
{
|
|
this.comp = connect.Comp;
|
|
this.startTime = DateTime.Now;
|
|
}
|
|
|
|
public SHistory GetData()
|
|
{
|
|
return new SHistory(comp.GetName(), startTime.ToShortTimeString());
|
|
|
|
}
|
|
|
|
public IComp GetComp()
|
|
{
|
|
return comp;
|
|
|
|
}
|
|
|
|
public string NameNode()
|
|
{
|
|
string buf;
|
|
if (comp.GetName() == null)
|
|
{
|
|
buf = comp.GetNetNameStr();
|
|
}
|
|
else
|
|
{
|
|
buf = comp.GetName();
|
|
if (comp.GetNetNameStr() != null) buf += "(" + comp.GetNetNameStr() + ")";
|
|
|
|
}
|
|
return buf;
|
|
}
|
|
public string ToStr
|
|
{
|
|
|
|
get {
|
|
string name = NameNode();
|
|
name = name.Length > 25 ? name.Substring(0,25): name;
|
|
string output = string.Format("{0,17:dd.MM.yy HH:mm:ss} {1,-25} {2,-9}", startTime, name, this.statusName);
|
|
return output;
|
|
}
|
|
}
|
|
}
|
|
}
|