diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-10 23:23:29 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-10 23:23:29 +0200 |
| commit | dbfde8706313c147a28b16bcc7e7fef158d930bb (patch) | |
| tree | 66643f03c403603f963067f721c2294d2671e9ab /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems | |
| parent | f8e1ff79cc2fa09b52093c6e029392b3456ad8bb (diff) | |
| download | Tango-dbfde8706313c147a28b16bcc7e7fef158d930bb.tar.gz Tango-dbfde8706313c147a28b16bcc7e7fef158d930bb.zip | |
Implemented GPIO Controller.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs | 72 |
1 files changed, 72 insertions, 0 deletions
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 new file mode 100644 index 000000000..c0a87842a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/IOItem.cs @@ -0,0 +1,72 @@ +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.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class IOItem : TechItem + { + public event EventHandler<bool> ValueChanged; + + public override object Data => new object(); + + private int _port; + + public int Port + { + get { return _port; } + set { _port = value; RaisePropertyChangedAuto(); } + } + + 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; + } + } +} |
