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.Core.Commands; using Tango.BL.Entities; using Tango.SharedUI.Helpers; using System.Collections.ObjectModel; namespace Tango.MachineStudio.Technician.TechItems { /// /// Represents a dancer controller item. /// /// [TechItem(15, false)] public class DancerItem : TechItem { private static List _dancerConfigurations; /// /// Gets or sets the winder configurations. /// public static List DancerConfigurations { get { return _dancerConfigurations; } set { _dancerConfigurations = value; } } static DancerItem() { DancerConfigurations = new List(); foreach (var winderType in BL.ObservablesStaticCollections.Instance.HardwareDancerTypes) { DancerConfigurations.Add(new HardwareDancer() { HardwareDancerType = winderType }); } } private HardwareDancerType _hardwareDancerType; /// /// Gets or sets the type of the hardware winder. /// [XmlIgnore] public HardwareDancerType HardwareDancerType { get { return _hardwareDancerType; } set { _hardwareDancerType = value; RaisePropertyChangedAuto(); TechName = _hardwareDancerType != null ? _hardwareDancerType.Description : null; ItemGuid = value != null ? value.Guid : null; if (_hardwareDancerType != null) { HardwareDancer = DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType == _hardwareDancerType); } } } private HardwareDancer _hardwareDancer; /// /// Gets or sets the hardware winder. /// [XmlIgnore] public HardwareDancer HardwareDancer { get { return _hardwareDancer; } set { _hardwareDancer = value; RaisePropertyChangedAuto(); } } /// /// Initializes a new instance of the class. /// public DancerItem() : base() { Name = "Dancer"; Description = "Dancer Controller"; Image = ResourceHelper.GetImageFromResources("Images/dancer-small.png"); Color = Colors.White; HardwareDancer = new HardwareDancer(); } /// /// Initializes a new instance of the class. /// /// Type of the winder. public DancerItem(HardwareDancerType winderType) : this() { HardwareDancerType = winderType; } /// /// Clones this instance. /// /// public override TechItem Clone() { DancerItem cloned = base.Clone() as DancerItem; cloned.HardwareDancerType = HardwareDancerType; return cloned; } } }