From 4fb8ff57dcd3bce39ac54d4c52cef091df8c570b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 4 Aug 2018 16:50:29 +0300 Subject: Implemented Blower, Break Sensor in Tech Board. Added to uploaded hardware config. !!!! --- .../TechItems/BlowerItem.cs | 102 +++++++++++++++++++++ .../TechItems/BreakSensorItem.cs | 102 +++++++++++++++++++++ .../TechItems/TechItem.cs | 2 + 3 files changed, 206 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs new file mode 100644 index 000000000..59a96f107 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs @@ -0,0 +1,102 @@ +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.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a Blower controller item. + /// + /// + [TechItem(16)] + public class BlowerItem : TechItem + { + private static List _BlowerConfigurations; + /// + /// Gets or sets the Blower configurations. + /// + public static List BlowerConfigurations + { + get { return _BlowerConfigurations; } + set { _BlowerConfigurations = value; } + } + + static BlowerItem() + { + BlowerConfigurations = new List(); + + foreach (var BlowerType in BL.ObservablesEntitiesAdapter.Instance.HardwareBlowerTypes) + { + BlowerConfigurations.Add(new HardwareBlower() { HardwareBlowerType = BlowerType }); + } + } + + private HardwareBlowerType _hardwareBlowerType; + /// + /// Gets or sets the type of the hardware Blower. + /// + [XmlIgnore] + public HardwareBlowerType HardwareBlowerType + { + get { return _hardwareBlowerType; } + set + { + _hardwareBlowerType = value; RaisePropertyChangedAuto(); TechName = _hardwareBlowerType != null ? _hardwareBlowerType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareBlowerType != null) + { + HardwareBlower = BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType == _hardwareBlowerType); + } + } + } + + private HardwareBlower _hardwareBlower; + /// + /// Gets or sets the hardware Blower. + /// + [XmlIgnore] + public HardwareBlower HardwareBlower + { + get { return _hardwareBlower; } + set { _hardwareBlower = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public BlowerItem() : base() + { + Name = "Blower"; + Description = "Blower Controller"; + Image = ResourceHelper.GetImageFromResources("Images/blower.png"); + Color = Colors.White; + HardwareBlower = new HardwareBlower(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Type of the Blower. + public BlowerItem(HardwareBlowerType BlowerType) : this() + { + HardwareBlowerType = BlowerType; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + BlowerItem cloned = base.Clone() as BlowerItem; + cloned.HardwareBlowerType = HardwareBlowerType; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs new file mode 100644 index 000000000..cf1ed682e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs @@ -0,0 +1,102 @@ +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.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a BreakSensor controller item. + /// + /// + [TechItem(17)] + public class BreakSensorItem : TechItem + { + private static List _BreakSensorConfigurations; + /// + /// Gets or sets the BreakSensor configurations. + /// + public static List BreakSensorConfigurations + { + get { return _BreakSensorConfigurations; } + set { _BreakSensorConfigurations = value; } + } + + static BreakSensorItem() + { + BreakSensorConfigurations = new List(); + + foreach (var BreakSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareBreakSensorTypes) + { + BreakSensorConfigurations.Add(new HardwareBreakSensor() { HardwareBreakSensorType = BreakSensorType }); + } + } + + private HardwareBreakSensorType _hardwareBreakSensorType; + /// + /// Gets or sets the type of the hardware BreakSensor. + /// + [XmlIgnore] + public HardwareBreakSensorType HardwareBreakSensorType + { + get { return _hardwareBreakSensorType; } + set + { + _hardwareBreakSensorType = value; RaisePropertyChangedAuto(); TechName = _hardwareBreakSensorType != null ? _hardwareBreakSensorType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareBreakSensorType != null) + { + HardwareBreakSensor = BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType == _hardwareBreakSensorType); + } + } + } + + private HardwareBreakSensor _hardwareBreakSensor; + /// + /// Gets or sets the hardware BreakSensor. + /// + [XmlIgnore] + public HardwareBreakSensor HardwareBreakSensor + { + get { return _hardwareBreakSensor; } + set { _hardwareBreakSensor = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public BreakSensorItem() : base() + { + Name = "Break Sensor"; + Description = "Break Sensor Controller"; + Image = ResourceHelper.GetImageFromResources("Images/break.png"); + Color = Colors.White; + HardwareBreakSensor = new HardwareBreakSensor(); + } + + /// + /// Initializes a new instance of the class. + /// + /// Type of the BreakSensor. + public BreakSensorItem(HardwareBreakSensorType BreakSensorType) : this() + { + HardwareBreakSensorType = BreakSensorType; + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + BreakSensorItem cloned = base.Clone() as BreakSensorItem; + cloned.HardwareBreakSensorType = HardwareBreakSensorType; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index a1aba597b..11188c69d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -34,6 +34,8 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(WinderItem))] [XmlInclude(typeof(DancerItem))] [XmlInclude(typeof(SpeedSensorItem))] + [XmlInclude(typeof(BlowerItem))] + [XmlInclude(typeof(BreakSensorItem))] [XmlInclude(typeof(ProcessParametersItem))] [XmlInclude(typeof(JobRunnerItem))] public abstract class TechItem : ExtendedObject -- cgit v1.3.1