From d5a5fd2813a98d97e0198342bbcc53df454c3e01 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 13 Feb 2018 16:35:28 +0200 Subject: Digital out. --- .../TechItems/DigitalOutItem.cs | 70 +++++++++++++++++++++ .../TechItems/IOItem.cs | 71 ---------------------- .../TechItems/TechItem.cs | 2 +- 3 files changed, 71 insertions(+), 72 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs new file mode 100644 index 000000000..817cfd9b7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs @@ -0,0 +1,70 @@ +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.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class DigitalOutItem : TechItem + { + public event EventHandler ValueChanged; + + private TechIo _techIo; + [XmlIgnore] + public TechIo TechIo + { + get { return _techIo; } + set { _techIo = value; RaisePropertyChangedAuto(); TechName = _techIo != null ? _techIo.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + + private bool _value; + [XmlIgnore] + public bool Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); ValueChanged?.Invoke(this, value); } + } + + private bool _effectiveValue; + [XmlIgnore] + public bool EffectiveValue + { + get { return _effectiveValue; } + set + { + if (_effectiveValue != value) + { + _effectiveValue = value; + RaisePropertyChangedAuto(); + _value = value; + RaisePropertyChanged(nameof(Value)); + } + } + } + + public DigitalOutItem() : base() + { + Name = "Digital Out"; + Description = "Digital Output Pin Controller"; + Image = ResourceHelper.GetImageFromResources("Images/binary.png"); + Color = Colors.White; + } + + public DigitalOutItem(TechIo techIo) : this() + { + TechIo = techIo; + } + + public override TechItem Clone() + { + DigitalOutItem cloned = base.Clone() as DigitalOutItem; + cloned.TechIo = TechIo; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs deleted file mode 100644 index 60d47b1c0..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs +++ /dev/null @@ -1,71 +0,0 @@ -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; -using Tango.SharedUI.Helpers; - -namespace Tango.MachineStudio.Technician.TechItems -{ - public class IOItem : TechItem - { - public event EventHandler ValueChanged; - - private int _port; - - public int Port - { - get { return _port; } - set { _port = value; RaisePropertyChangedAuto(); TechName = "GPIO " + Port; } - } - - private bool _value; - [XmlIgnore] - public bool Value - { - get { return _value; } - set { _value = value; RaisePropertyChangedAuto(); ValueChanged?.Invoke(this, value); } - } - - private bool _effectiveValue; - [XmlIgnore] - public bool EffectiveValue - { - get { return _effectiveValue; } - set - { - if (_effectiveValue != value) - { - _effectiveValue = value; - RaisePropertyChangedAuto(); - _value = value; - RaisePropertyChanged(nameof(Value)); - } - } - } - - - public IOItem() : base() - { - Name = "GPIO Controller"; - Description = "GPIO Controller"; - Image = ResourceHelper.GetImageFromResources("Images/binary.png"); - Color = Colors.White; - } - - public IOItem(int port) : this() - { - Port = port; - } - - public override TechItem Clone() - { - IOItem cloned = base.Clone() as IOItem; - cloned.Port = Port; - 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 a7b5ae5b9..92ad1c536 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 @@ -14,7 +14,7 @@ using Tango.Integration.Observables; namespace Tango.MachineStudio.Technician.TechItems { [XmlInclude(typeof(DispenserItem))] - [XmlInclude(typeof(IOItem))] + [XmlInclude(typeof(DigitalOutItem))] [XmlInclude(typeof(MeterItem))] [XmlInclude(typeof(MonitorItem))] [XmlInclude(typeof(MotorItem))] -- cgit v1.3.1