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. --- .../Converters/TechIosToDigitalOutsConverter.cs | 35 +++++++ .../Editors/DigitalOutElementEditor.xaml | 103 ++++++++++++++++++++ .../Editors/DigitalOutElementEditor.xaml.cs | 90 +++++++++++++++++ .../Editors/IOElementEditor.xaml | 106 --------------------- .../Editors/IOElementEditor.xaml.cs | 102 -------------------- .../Editors/MotorElementEditor.xaml | 2 +- .../PropertiesTemplates/DigitalOutTemplate.xaml | 33 +++++++ .../PropertiesTemplates/DigitalOutTemplate.xaml.cs | 28 ++++++ .../PropertiesTemplates/IOTemplate.xaml | 33 ------- .../PropertiesTemplates/IOTemplate.xaml.cs | 37 ------- .../Tango.MachineStudio.Technician.csproj | 15 +-- .../TechItems/DigitalOutItem.cs | 70 ++++++++++++++ .../TechItems/IOItem.cs | 71 -------------- .../TechItems/TechItem.cs | 2 +- .../ViewModels/MachineTechViewVM.cs | 33 ++++--- .../Views/MachineTechView.xaml | 4 +- 16 files changed, 389 insertions(+), 375 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs 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') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs new file mode 100644 index 000000000..734c4bebf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalOutsConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class TechIosToDigitalOutsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + ObservableCollection ios = value as ObservableCollection; + + if (ios != null) + { + return ios.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).ToObservableCollection(); + } + else + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml new file mode 100644 index 000000000..dcf78ca69 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs new file mode 100644 index 000000000..6428ccf1d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.Editors; +using Tango.Integration.Observables; +using Tango.MachineStudio.Technician.TechItems; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class DigitalOutElementEditor : ElementEditor + { + public DigitalOutElementEditor() + : base() + { + InitializeComponent(); + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem) + : this() + { + DigitalOutItem = digitalOutItem; + DataContext = DigitalOutItem; + } + + public DigitalOutElementEditor(DigitalOutItem digitalOutItem, Rect bounds) + : this(digitalOutItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DigitalOutItem _digitalOutItem; + + public DigitalOutItem DigitalOutItem + { + get { return _digitalOutItem; } + set { _digitalOutItem = value; RaisePropertyChanged(nameof(DigitalOutItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DigitalOutItem.Clone() as DigitalOutItem; + DigitalOutElementEditor cloned = new DigitalOutElementEditor(clonedItem); + cloned.Top = Top; + cloned.Left = Left; + cloned.Width = Width; + cloned.Height = Height; + cloned.Angle = Angle; + return cloned; + } + catch (Exception ex) + { + throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); + } + } + + /// + /// Gets the hosted element. + /// + [ParameterIgnore] + public override Object HostedElement + { + get { return DigitalOutItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml deleted file mode 100644 index aa4f8aee6..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GPIO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs deleted file mode 100644 index 95710abd3..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/IOElementEditor.xaml.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Tango.Editors; -using Tango.Integration.Observables; -using Tango.MachineStudio.Technician.TechItems; - -namespace Tango.MachineStudio.Technician.Editors -{ - [ContentProperty("InnerContent")] - public partial class IOElementEditor : ElementEditor - { - /// - /// Initializes a new instance of the class. - /// - public IOElementEditor() - : base() - { - InitializeComponent(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The framework element. - public IOElementEditor(IOItem ioItem) - : this() - { - IOItem = ioItem; - DataContext = IOItem; - } - - /// - /// Initializes a new instance of the class. - /// - /// The framework element. - /// The bounds. - public IOElementEditor(IOItem monitorItem, Rect bounds) - : this(monitorItem) - { - Left = bounds.Left; - Top = bounds.Top; - Width = bounds.Width; - Height = bounds.Height; - } - - private IOItem _monitorItem; - - public IOItem IOItem - { - get { return _monitorItem; } - set { _monitorItem = value; RaisePropertyChanged(nameof(IOItem)); } - } - - - /// - /// Clones this instance. - /// - /// - public override IElementEditor Clone() - { - try - { - var clonedItem = IOItem.Clone() as IOItem; - IOElementEditor cloned = new IOElementEditor(clonedItem); - cloned.Top = Top; - cloned.Left = Left; - cloned.Width = Width; - cloned.Height = Height; - cloned.Angle = Angle; - return cloned; - } - catch (Exception ex) - { - throw new InvalidOperationException("Could not clone this editor. You may have to create a custom editor and implement a custom Clone method.", ex); - } - } - - /// - /// Gets the hosted element. - /// - [ParameterIgnore] - public override Object HostedElement - { - get { return IOItem; } - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index 860072282..fb0466177 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -162,7 +162,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml new file mode 100644 index 000000000..9d30e744c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + Selected Pin + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs new file mode 100644 index 000000000..58a3fcb8f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.PropertiesTemplates +{ + /// + /// Interaction logic for MonitorTemplate.xaml + /// + public partial class DigitalOutTemplate : UserControl + { + public DigitalOutTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml deleted file mode 100644 index c03b72837..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - Selected Port - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs deleted file mode 100644 index fae3586dc..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/IOTemplate.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Technician.PropertiesTemplates -{ - /// - /// Interaction logic for MonitorTemplate.xaml - /// - public partial class IOTemplate : UserControl - { - public IOTemplate() - { - InitializeComponent(); - - List ports = new List(); - - for (int i = 0; i < 120; i++) - { - ports.Add(i); - } - - combo.ItemsSource = ports; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index e8b14e277..820a7ee57 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -99,12 +99,13 @@ + DispenserElementEditor.xaml - - IOElementEditor.xaml + + DigitalOutElementEditor.xaml MotorGroupElementEditor.xaml @@ -129,8 +130,8 @@ - - IOTemplate.xaml + + DigitalOutTemplate.xaml MeterTemplate.xaml @@ -156,7 +157,7 @@ SingleGraphTemplate.xaml - + @@ -196,7 +197,7 @@ MSBuild:Compile Designer - + MSBuild:Compile Designer @@ -228,7 +229,7 @@ MSBuild:Compile Designer - + MSBuild:Compile Designer 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))] diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 1b0ee0a56..c886c2345 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -16,6 +16,7 @@ using System.Windows.Media; using Tango.Core.Helpers; using Tango.Editors; using Tango.Integration.Observables; +using Tango.Integration.Observables.Enumerations; using Tango.Integration.Operators; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; @@ -211,13 +212,15 @@ namespace Tango.MachineStudio.Technician.ViewModels } } } - else if (item.GetType() == typeof(IOItem)) + else if (item.GetType() == typeof(DigitalOutItem)) { - IOItem ioItem = item as IOItem; + DigitalOutItem digitalOutItem = item as DigitalOutItem; - if (ioItem.Port < data.GPIO.Count) + var digitalPin = data.DigitalPins.SingleOrDefault(x => x.Port == digitalOutItem.TechIo.Port); + + if (digitalPin != null) { - ioItem.EffectiveValue = data.GPIO[ioItem.Port]; + digitalOutItem.EffectiveValue = digitalPin.Value; } } else if (item.GetType() == typeof(MeterItem)) @@ -355,10 +358,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(bounds, Adapter.TechDispensers.FirstOrDefault()); InitDispenserItem(editor.DispenserItem); } - else if (item is IOItem) + else if (item is DigitalOutItem) { - var editor = CreateElement(bounds, 0); - InitIOItem(editor.IOItem); + var editor = CreateElement(bounds, Adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).FirstOrDefault()); + InitDigitalOutItem(editor.DigitalOutItem); } else if (item is ThreadMotionItem) { @@ -423,10 +426,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(item); InitDispenserItem(editor.DispenserItem); } - else if (item is IOItem) + else if (item is DigitalOutItem) { - var editor = CreateElement(item); - InitIOItem(editor.IOItem); + var editor = CreateElement(item); + InitDigitalOutItem(editor.DigitalOutItem); } else if (item is ThreadMotionItem) { @@ -507,10 +510,10 @@ namespace Tango.MachineStudio.Technician.ViewModels var dispenser = element.HostedElement as DispenserItem; InitDispenserItem(dispenser); } - else if (element is IOElementEditor) + else if (element is DigitalOutItem) { - var ioItem = element.HostedElement as IOItem; - InitIOItem(ioItem); + var ioItem = element.HostedElement as DigitalOutItem; + InitDigitalOutItem(ioItem); } else if (element is ThreadMotionItem) { @@ -669,13 +672,13 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } - private void InitIOItem(IOItem item) + private void InitDigitalOutItem(DigitalOutItem item) { item.ValueChanged += async (x, value) => { try { - await MachineOperator.SetGPIOState(new SetGPIOStateRequest() { Port = item.Port, Value = value }); + await MachineOperator.SetDigitalOut(new SetDigitalOutRequest() { Port = item.TechIo.Port, Value = value }); } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 1658b97d8..784bd56fb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -361,8 +361,8 @@ - - + + -- cgit v1.3.1