using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; using Tango.BL.Entities; using Tango.MachineStudio.Technician.Editors; using Tango.MachineStudio.Technician.Helpers; using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { /// /// Represents a single channel real-time graph item. /// /// [TechItem(4)] public class SingleGraphItem : 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 = 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 SingleGraphElementEditor Editor { get; set; } /// /// Initializes a new instance of the class. /// public SingleGraphItem() : base() { Name = "Single Channel Graph"; Description = "Single channel real-time graph"; Image = ResourceHelper.GetImageFromResources("Images/single-graph.png"); Color = Colors.DodgerBlue; } /// /// Initializes a new instance of the class. /// /// The db tech monitor. public SingleGraphItem(TechMonitor techMonitor) : this() { TechMonitor = techMonitor; } /// /// Clones this instance. /// /// public override TechItem Clone() { SingleGraphItem cloned = base.Clone() as SingleGraphItem; cloned.TechMonitor = TechMonitor; return cloned; } } }