using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Tango.BL.Entities;
using Tango.MachineStudio.Technician.Editors;
using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.Technician.TechItems
{
///
/// Represents a multi channel real-time graph item.
///
///
[TechItem(5)]
public class MultiGraphItem : TechItem
{
private TechMonitor _techMonitor;
///
/// Gets or sets the db tech monitor.
///
[XmlIgnore]
public TechMonitor TechMonitor
{
get { return _techMonitor; }
set
{
TechMonitor old = _techMonitor;
_techMonitor = value;
RaisePropertyChangedAuto();
if (_techMonitor != old && Editor != null)
{
Editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame);
Editor.InnerGraph.InvalidateGraph();
}
ItemGuid = value != null ? value.Guid : null;
TechName = _techMonitor != null ? _techMonitor.Description : null;
}
}
///
/// Gets or sets the item editor.
///
[XmlIgnore]
public MultiGraphElementEditor Editor { get; set; }
///
/// Initializes a new instance of the class.
///
public MultiGraphItem() : base()
{
Name = "Multi Channel Graph";
Description = "Multi channel real-time graph";
Image = ResourceHelper.GetImageFromResources("Images/multi-graph.png");
}
///
/// Initializes a new instance of the class.
///
/// The db tech monitor.
public MultiGraphItem(TechMonitor techMonitor) : this()
{
TechMonitor = techMonitor;
}
///
/// Clones this instance.
///
///
public override TechItem Clone()
{
MultiGraphItem cloned = base.Clone() as MultiGraphItem;
cloned.TechMonitor = TechMonitor;
return cloned;
}
}
}