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. --- .../ViewModels/MachineTechViewVM.cs | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') 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) { -- cgit v1.3.1 From 7fd31b19dc4a836230bed3e4c38f5cc94e5d0a37 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 13 Feb 2018 17:28:44 +0200 Subject: Implemented Digital In. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes Software/Graphics/digital-in.png | Bin 0 -> 2082 bytes .../Converters/TechIosToDigitalInsConverter.cs | 35 ++++++++ .../Editors/DigitalInElementEditor.xaml | 92 ++++++++++++++++++++ .../Editors/DigitalInElementEditor.xaml.cs | 90 ++++++++++++++++++++ .../Images/digital-in.png | Bin 0 -> 2082 bytes .../PropertiesTemplates/DigitalInTemplate.xaml | 33 ++++++++ .../PropertiesTemplates/DigitalInTemplate.xaml.cs | 28 +++++++ .../PropertiesTemplates/DigitalOutTemplate.xaml | 2 +- .../Tango.MachineStudio.Technician.csproj | 20 +++++ .../TechItems/DigitalInItem.cs | 52 ++++++++++++ .../TechItems/DigitalOutItem.cs | 1 + .../TechItems/DispenserItem.cs | 1 + .../TechItems/MeterItem.cs | 1 + .../TechItems/MonitorItem.cs | 1 + .../TechItems/MotorGroupItem.cs | 1 + .../TechItems/MotorItem.cs | 1 + .../TechItems/MultiGraphItem.cs | 1 + .../TechItems/SingleGraphItem.cs | 1 + .../TechItems/TechItem.cs | 4 +- .../TechItems/TechItemAttribute.cs | 18 ++++ .../TechItems/ThreadMotionItem.cs | 1 + .../ViewModels/MachineTechViewVM.cs | 93 +++++++++++++-------- .../Views/MachineTechView.xaml | 3 + .../Tango.Emulations/Emulators/MachineEmulator.cs | 23 +++-- .../Tango.Settings/SettingsManager.cs | 21 ++++- 27 files changed, 477 insertions(+), 46 deletions(-) create mode 100644 Software/Graphics/digital-in.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 5c86da125..b83d30dea 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 411d93cb6..2708ce2f8 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Graphics/digital-in.png b/Software/Graphics/digital-in.png new file mode 100644 index 000000000..3b5ebac18 Binary files /dev/null and b/Software/Graphics/digital-in.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.cs new file mode 100644 index 000000000..4b587743d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TechIosToDigitalInsConverter.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 TechIosToDigitalInsConverter : 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.DigitalInput.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/DigitalInElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml new file mode 100644 index 000000000..29eab7042 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml.cs new file mode 100644 index 000000000..e884e70b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.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 DigitalInElementEditor : ElementEditor + { + public DigitalInElementEditor() + : base() + { + InitializeComponent(); + } + + public DigitalInElementEditor(DigitalInItem digitalInItem) + : this() + { + DigitalInItem = digitalInItem; + DataContext = DigitalInItem; + } + + public DigitalInElementEditor(DigitalInItem digitalInItem, Rect bounds) + : this(digitalInItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DigitalInItem _digitalInItem; + + public DigitalInItem DigitalInItem + { + get { return _digitalInItem; } + set { _digitalInItem = value; RaisePropertyChanged(nameof(DigitalInItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = DigitalInItem.Clone() as DigitalInItem; + DigitalInElementEditor cloned = new DigitalInElementEditor(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 DigitalInItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png new file mode 100644 index 000000000..3b5ebac18 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/digital-in.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml new file mode 100644 index 000000000..1121fe9e1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + Selected Pin + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.xaml.cs new file mode 100644 index 000000000..9862a95b9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalInTemplate.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 DigitalInTemplate : UserControl + { + public DigitalInTemplate() + { + InitializeComponent(); + } + } +} 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 index 9d30e744c..dafceefcb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DigitalOutTemplate.xaml @@ -22,7 +22,7 @@ - + Selected Pin 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 820a7ee57..08c1980f4 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,8 +99,12 @@ + + + DigitalInElementEditor.xaml + DispenserElementEditor.xaml @@ -130,6 +134,9 @@ + + DigitalInTemplate.xaml + DigitalOutTemplate.xaml @@ -157,6 +164,7 @@ SingleGraphTemplate.xaml + @@ -169,6 +177,7 @@ + @@ -193,6 +202,10 @@ GlobalVersionInfo.cs + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -229,6 +242,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -436,5 +453,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs new file mode 100644 index 000000000..f6d09ae59 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs @@ -0,0 +1,52 @@ +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 +{ + [TechItem(0)] + public class DigitalInItem : TechItem + { + 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(); } + } + + public DigitalInItem() : base() + { + Name = "Digital In"; + Description = "Digital Input Pin LED"; + Image = ResourceHelper.GetImageFromResources("Images/digital-in.png"); + Color = Colors.White; + } + + public DigitalInItem(TechIo techIo) : this() + { + TechIo = techIo; + } + + public override TechItem Clone() + { + DigitalInItem cloned = base.Clone() as DigitalInItem; + cloned.TechIo = TechIo; + return cloned; + } + } +} 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 index 817cfd9b7..ae8a0a023 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs @@ -10,6 +10,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(1)] public class DigitalOutItem : TechItem { public event EventHandler ValueChanged; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs index bc656c67c..8bb72fc66 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -11,6 +11,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(8)] public class DispenserItem : TechItem { public event EventHandler ActionExecuted; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs index 8fb7c83cc..d7f019fa9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs @@ -11,6 +11,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(3)] public class MeterItem : TechItem { private TechMonitor _techMonitor; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs index f81d98438..987c6cc99 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs @@ -10,6 +10,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(2)] public class MonitorItem : TechItem { private TechMonitor _techMonitor; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs index 35aae5cd7..551bf1f0a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs @@ -12,6 +12,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(7)] public class MotorGroupItem : TechItem { public event EventHandler ActionExecuted; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index 77a0c1b4d..ce668a464 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -11,6 +11,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(6)] public class MotorItem : TechItem { public event EventHandler ActionExecuted; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 232442357..65ee521ef 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -10,6 +10,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(5)] public class MultiGraphItem : TechItem { private TechMonitor _techMonitor; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 1efcd93a8..9d44c6a33 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -10,6 +10,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(4)] public class SingleGraphItem : TechItem { private TechMonitor _techMonitor; 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 92ad1c536..a64cd7908 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 @@ -10,6 +10,7 @@ using System.Xml.Serialization; using Tango.Core; using Tango.Core.Helpers; using Tango.Integration.Observables; +using System.Reflection; namespace Tango.MachineStudio.Technician.TechItems { @@ -22,6 +23,7 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(SingleGraphItem))] [XmlInclude(typeof(ThreadMotionItem))] [XmlInclude(typeof(MotorGroupItem))] + [XmlInclude(typeof(DigitalInItem))] public abstract class TechItem : ExtendedObject { public TechItem() @@ -177,7 +179,7 @@ namespace Tango.MachineStudio.Technician.TechItems { List items = new List(); - foreach (var type in typeof(TechItem).Assembly.GetTypes().Where(x => typeof(TechItem).IsAssignableFrom(x) && !x.IsAbstract)) + foreach (var type in typeof(TechItem).Assembly.GetTypes().Where(x => typeof(TechItem).IsAssignableFrom(x) && !x.IsAbstract).OrderBy(x => x.GetCustomAttribute().Index)) { items.Add(Activator.CreateInstance(type) as TechItem); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs new file mode 100644 index 000000000..cd6dfb1ea --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class TechItemAttribute : Attribute + { + public int Index { get; set; } + + public TechItemAttribute(int index) + { + Index = index; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs index 04b71ac8c..79ecf9372 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs @@ -9,6 +9,7 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + [TechItem(9)] public class ThreadMotionItem : TechItem { public event EventHandler ActionExecuted; 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 c886c2345..c6f72be3e 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 @@ -212,17 +212,6 @@ namespace Tango.MachineStudio.Technician.ViewModels } } } - else if (item.GetType() == typeof(DigitalOutItem)) - { - DigitalOutItem digitalOutItem = item as DigitalOutItem; - - var digitalPin = data.DigitalPins.SingleOrDefault(x => x.Port == digitalOutItem.TechIo.Port); - - if (digitalPin != null) - { - digitalOutItem.EffectiveValue = digitalPin.Value; - } - } else if (item.GetType() == typeof(MeterItem)) { MeterItem meterItem = item as MeterItem; @@ -269,6 +258,28 @@ namespace Tango.MachineStudio.Technician.ViewModels } } } + else if (item.GetType() == typeof(DigitalOutItem)) + { + DigitalOutItem digitalOutItem = item as DigitalOutItem; + + var digitalPin = data.DigitalPins.SingleOrDefault(x => x.Port == digitalOutItem.TechIo.Port); + + if (digitalPin != null) + { + digitalOutItem.EffectiveValue = digitalPin.Value; + } + } + else if (item.GetType() == typeof(DigitalInItem)) + { + DigitalInItem digitalInItem = item as DigitalInItem; + + var digitalPin = data.DigitalPins.SingleOrDefault(x => x.Port == digitalInItem.TechIo.Port); + + if (digitalPin != null) + { + digitalInItem.Value = digitalPin.Value; + } + } } } } @@ -358,11 +369,6 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(bounds, Adapter.TechDispensers.FirstOrDefault()); InitDispenserItem(editor.DispenserItem); } - else if (item is DigitalOutItem) - { - var editor = CreateElement(bounds, Adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).FirstOrDefault()); - InitDigitalOutItem(editor.DigitalOutItem); - } else if (item is ThreadMotionItem) { var editor = CreateElement(bounds, null); @@ -373,6 +379,15 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(bounds, null); InitMotorGroupItem(editor.MotorGroupItem); } + else if (item is DigitalOutItem) + { + var editor = CreateElement(bounds, Adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).FirstOrDefault()); + InitDigitalOutItem(editor.DigitalOutItem); + } + else if (item is DigitalInItem) + { + CreateElement(bounds, Adapter.TechIos.Where(x => x.Type == IOType.DigitalInput.ToInt32()).FirstOrDefault()); + } } private Editor CreateElement(Rect bounds, Value value) where Editor : IElementEditor where Tech : TechItem @@ -426,11 +441,6 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(item); InitDispenserItem(editor.DispenserItem); } - else if (item is DigitalOutItem) - { - var editor = CreateElement(item); - InitDigitalOutItem(editor.DigitalOutItem); - } else if (item is ThreadMotionItem) { var editor = CreateElement(item); @@ -441,6 +451,17 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = CreateElement(item); InitMotorGroupItem(editor.MotorGroupItem); } + else if (item is DigitalOutItem) + { + (item as DigitalOutItem).TechIo = Adapter.TechIos.FirstOrDefault(x => x.Guid == item.ItemGuid); + var editor = CreateElement(item); + InitDigitalOutItem(editor.DigitalOutItem); + } + else if (item is DigitalInItem) + { + (item as DigitalInItem).TechIo = Adapter.TechIos.FirstOrDefault(x => x.Guid == item.ItemGuid); + CreateElement(item); + } } public void OnElementsRemoved(List elements) @@ -672,21 +693,6 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } - private void InitDigitalOutItem(DigitalOutItem item) - { - item.ValueChanged += async (x, value) => - { - try - { - await MachineOperator.SetDigitalOut(new SetDigitalOutRequest() { Port = item.TechIo.Port, Value = value }); - } - catch (Exception ex) - { - //TODO: Show Exception. - } - }; - } - private void InitSingleGraphitem(SingleGraphItem item, SingleGraphElementEditor editor) { editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); @@ -815,6 +821,21 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + private void InitDigitalOutItem(DigitalOutItem item) + { + item.ValueChanged += async (x, value) => + { + try + { + await MachineOperator.SetDigitalOut(new SetDigitalOutRequest() { Port = item.TechIo.Port, Value = value }); + } + catch (Exception ex) + { + //TODO: Show Exception. + } + }; + } + #endregion #region Public Methods 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 784bd56fb..a55d335ea 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 @@ -355,6 +355,9 @@ + + + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index f998fab2e..c6f1cb1ab 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -37,7 +37,8 @@ namespace Tango.Emulations.Emulators private List _dispenserHomingRequestCodes; private double _graphAmplitude; private double _graphFrequency; - private List _digitalPinsStates; + private List _digitalOutputPinsStates; + private List _digitalInputPinsStates; #region Constructors @@ -69,12 +70,17 @@ namespace Tango.Emulations.Emulators _motorHomingRequestCodes = new List(); _dispenserJoggingRequestCodes = new List(); _dispenserHomingRequestCodes = new List(); - _digitalPinsStates = new List(); + _digitalOutputPinsStates = new List(); var adapter = ObservablesEntitiesAdapter.Instance; adapter.Initialize(); - _digitalPinsStates = adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32() || x.Type == IOType.DigitalInput.ToInt32()).Select(x => new DigitalPin() + _digitalOutputPinsStates = adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).Select(x => new DigitalPin() + { + Port = x.Port, + }).ToList(); + + _digitalInputPinsStates = adapter.TechIos.Where(x => x.Type == IOType.DigitalInput.ToInt32()).Select(x => new DigitalPin() { Port = x.Port, }).ToList(); @@ -240,7 +246,7 @@ namespace Tango.Emulations.Emulators res.Dispenser8MotorFrequency.AddRange(dispenserFrequencies[7].Data); } - res.DigitalPins.AddRange(_digitalPinsStates); + res.DigitalPins.AddRange(_digitalOutputPinsStates.Concat(_digitalInputPinsStates)); Transporter.SendResponse(res, request.Container.Token); Thread.Sleep(10); @@ -344,8 +350,15 @@ namespace Tango.Emulations.Emulators { _graphFrequency = 10; + var inputPin = _digitalInputPinsStates.FirstOrDefault(); + for (int i = 0; i < 100; i++) { + if (inputPin != null) + { + inputPin.Value = !inputPin.Value; + } + Transporter.SendResponse(new MotorHomingResponse() { MaxProgress = 100, Progress = i }, request.Container.Token); if (!_motorHomingRequestCodes.Contains(homeRequest.Code)) @@ -451,7 +464,7 @@ namespace Tango.Emulations.Emulators private void HandleSetDigitalOutRequest(TangoMessage request) { LogManager.Log("Set digital output pin request received: " + Environment.NewLine + request.Message.ToJsonString()); - var pinState = _digitalPinsStates.SingleOrDefault(x => x.Port == request.Message.Port); + var pinState = _digitalOutputPinsStates.SingleOrDefault(x => x.Port == request.Message.Port); if (pinState != null) { pinState.Value = request.Message.Value; diff --git a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs index 8455cb91d..ca213cc3f 100644 --- a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs +++ b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.Logging; using Tango.Serialization; @@ -96,18 +97,34 @@ namespace Tango.Settings { if (IsInitialized) return; + IsInitialized = true; + LogManager.Log("Initializing application configuration..."); DefaultFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Settings.xml"); DefaultFolder = Path.GetDirectoryName(DefaultFilePath); + bool waited = false; + + Retry: + try { Default = LoadFromXML(DefaultFilePath); } catch (Exception ex) { - LogManager.Log(ex, "Could not load application configuration."); + if (!waited) + { + LogManager.Log(ex, "Could not load application configuration. Retrying in 1 second..."); + waited = true; + Thread.Sleep(1000); + goto Retry; + } + else + { + LogManager.Log(ex, "Could not load application configuration."); + } try { @@ -138,8 +155,6 @@ namespace Tango.Settings { LogManager.Log("Application configuration loaded successfully."); } - - IsInitialized = true; } } } -- cgit v1.3.1 From 39d2d7ff77e3ac949db6d9adde861275401e5e57 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 13 Feb 2018 18:35:58 +0200 Subject: Added embedded version information to technician view. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Diagnostics/PushDiagnosticsResponse.proto | 7 +- .../ViewModels/MachineTechViewVM.cs | 32 +++++++ .../Views/MachineTechView.xaml | 12 +++ .../Tango.Emulations/Emulators/MachineEmulator.cs | 4 + .../Diagnostics/PushDiagnosticsResponse.cs | 99 +++++++++++++++++++-- 7 files changed, 148 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index b83d30dea..746556e9e 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 2708ce2f8..d98f40fca 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto index 08045c2d9..c6af16fce 100644 --- a/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto +++ b/Software/PMR/Messages/Diagnostics/PushDiagnosticsResponse.proto @@ -25,6 +25,11 @@ message PushDiagnosticsResponse repeated double Dispenser7MotorFrequency = 11; repeated double Dispenser8MotorFrequency = 12; - //GPIO Ports States + //Digital Pins States repeated DigitalPin DigitalPins = 13; + + //Software Information + string Version = 14; + string VersionName = 15; + string VersionBuildDate = 16; } \ No newline at end of file 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 c6f72be3e..2a55d12c6 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 @@ -37,6 +37,8 @@ namespace Tango.MachineStudio.Technician.ViewModels private static object _elementsLock = new object(); private String _lastTechProjectFile; private INotificationProvider _notification; + private DateTime _lastDiagnosticsResponseUpdate; + private const int MIN_DIAGNOSTICS_UPDATE_MILI = 500; #region Properties @@ -110,6 +112,29 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _hideMenu = value; RaisePropertyChangedAuto(); } } + private PushDiagnosticsResponse _currentDiagnosticsResponse; + /// + /// Gets or sets the current diagnostics response. + /// + public PushDiagnosticsResponse CurrentDiagnosticsResponse + { + get { return _currentDiagnosticsResponse; } + set { _currentDiagnosticsResponse = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponse)); } + } + + private int _currentDiagnosticsResponseSize; + /// + /// Gets or sets the size of the current diagnostics response. + /// + /// + /// The size of the current diagnostics response. + /// + public int CurrentDiagnosticsResponseSize + { + get { return _currentDiagnosticsResponseSize; } + set { _currentDiagnosticsResponseSize = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponseSize)); } + } + #endregion #region Commands @@ -192,6 +217,13 @@ namespace Tango.MachineStudio.Technician.ViewModels private void PopulateDiagnosticsData(PushDiagnosticsResponse data) { + if (DateTime.Now > _lastDiagnosticsResponseUpdate.AddMilliseconds(MIN_DIAGNOSTICS_UPDATE_MILI)) + { + CurrentDiagnosticsResponse = data; + _lastDiagnosticsResponseUpdate = DateTime.Now; + CurrentDiagnosticsResponseSize = data.CalculateSize(); + } + lock (_elementsLock) { var elements = Elements.ToList(); 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 a55d335ea..5996c351b 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 @@ -20,6 +20,7 @@ + @@ -215,6 +216,17 @@ + + + + + Version Name: + Version Number: + Build Date: + Diagnostics Frame Size: + + + diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index c6f1cb1ab..5cfa95295 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -248,6 +248,10 @@ namespace Tango.Emulations.Emulators res.DigitalPins.AddRange(_digitalOutputPinsStates.Concat(_digitalInputPinsStates)); + res.Version = "1.0.0.0"; + res.VersionBuildDate = DateTime.Now.ToString(); + res.VersionName = "Embedded Emulator"; + Transporter.SendResponse(res, request.Container.Token); Thread.Sleep(10); } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs index d86dc8882..d08eb25dc 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/PushDiagnosticsResponse.cs @@ -24,7 +24,7 @@ namespace Tango.PMR.Diagnostics { string.Concat( "Ch1QdXNoRGlhZ25vc3RpY3NSZXNwb25zZS5wcm90bxIVVGFuZ28uUE1SLkRp", "YWdub3N0aWNzGhFEb3VibGVBcnJheS5wcm90bxoQRGlnaXRhbFBpbi5wcm90", - "byLqAwoXUHVzaERpYWdub3N0aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xl", + "byKqBAoXUHVzaERpYWdub3N0aWNzUmVzcG9uc2USFAoMRGFuY2VyMUFuZ2xl", "GAEgAygBEhQKDERhbmNlcjJBbmdsZRgCIAMoARIUCgxEYW5jZXIzQW5nbGUY", "AyADKAESRQoZRGlzcGVuc2Vyc01vdG9yc0ZyZXF1ZW5jeRgEIAMoCzIiLlRh", "bmdvLlBNUi5EaWFnbm9zdGljcy5Eb3VibGVBcnJheRIgChhEaXNwZW5zZXIx", @@ -34,12 +34,14 @@ namespace Tango.PMR.Diagnostics { "NU1vdG9yRnJlcXVlbmN5GAkgAygBEiAKGERpc3BlbnNlcjZNb3RvckZyZXF1", "ZW5jeRgKIAMoARIgChhEaXNwZW5zZXI3TW90b3JGcmVxdWVuY3kYCyADKAES", "IAoYRGlzcGVuc2VyOE1vdG9yRnJlcXVlbmN5GAwgAygBEjYKC0RpZ2l0YWxQ", - "aW5zGA0gAygLMiEuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkRpZ2l0YWxQaW5C", - "IQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + "aW5zGA0gAygLMiEuVGFuZ28uUE1SLkRpYWdub3N0aWNzLkRpZ2l0YWxQaW4S", + "DwoHVmVyc2lvbhgOIAEoCRITCgtWZXJzaW9uTmFtZRgPIAEoCRIYChBWZXJz", + "aW9uQnVpbGREYXRlGBAgASgJQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlh", + "Z25vc3RpY3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.DoubleArrayReflection.Descriptor, global::Tango.PMR.Diagnostics.DigitalPinReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "DigitalPins" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.PushDiagnosticsResponse), global::Tango.PMR.Diagnostics.PushDiagnosticsResponse.Parser, new[]{ "Dancer1Angle", "Dancer2Angle", "Dancer3Angle", "DispensersMotorsFrequency", "Dispenser1MotorFrequency", "Dispenser2MotorFrequency", "Dispenser3MotorFrequency", "Dispenser4MotorFrequency", "Dispenser5MotorFrequency", "Dispenser6MotorFrequency", "Dispenser7MotorFrequency", "Dispenser8MotorFrequency", "DigitalPins", "Version", "VersionName", "VersionBuildDate" }, null, null, null) })); } #endregion @@ -83,6 +85,9 @@ namespace Tango.PMR.Diagnostics { dispenser7MotorFrequency_ = other.dispenser7MotorFrequency_.Clone(); dispenser8MotorFrequency_ = other.dispenser8MotorFrequency_.Clone(); digitalPins_ = other.digitalPins_.Clone(); + version_ = other.version_; + versionName_ = other.versionName_; + versionBuildDate_ = other.versionBuildDate_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -222,13 +227,49 @@ namespace Tango.PMR.Diagnostics { = pb::FieldCodec.ForMessage(106, global::Tango.PMR.Diagnostics.DigitalPin.Parser); private readonly pbc::RepeatedField digitalPins_ = new pbc::RepeatedField(); /// - ///GPIO Ports States + ///Digital Pins States /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField DigitalPins { get { return digitalPins_; } } + /// Field number for the "Version" field. + public const int VersionFieldNumber = 14; + private string version_ = ""; + /// + ///Software Information + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Version { + get { return version_; } + set { + version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "VersionName" field. + public const int VersionNameFieldNumber = 15; + private string versionName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string VersionName { + get { return versionName_; } + set { + versionName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "VersionBuildDate" field. + public const int VersionBuildDateFieldNumber = 16; + private string versionBuildDate_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string VersionBuildDate { + get { return versionBuildDate_; } + set { + versionBuildDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as PushDiagnosticsResponse); @@ -255,6 +296,9 @@ namespace Tango.PMR.Diagnostics { if(!dispenser7MotorFrequency_.Equals(other.dispenser7MotorFrequency_)) return false; if(!dispenser8MotorFrequency_.Equals(other.dispenser8MotorFrequency_)) return false; if(!digitalPins_.Equals(other.digitalPins_)) return false; + if (Version != other.Version) return false; + if (VersionName != other.VersionName) return false; + if (VersionBuildDate != other.VersionBuildDate) return false; return true; } @@ -274,6 +318,9 @@ namespace Tango.PMR.Diagnostics { hash ^= dispenser7MotorFrequency_.GetHashCode(); hash ^= dispenser8MotorFrequency_.GetHashCode(); hash ^= digitalPins_.GetHashCode(); + if (Version.Length != 0) hash ^= Version.GetHashCode(); + if (VersionName.Length != 0) hash ^= VersionName.GetHashCode(); + if (VersionBuildDate.Length != 0) hash ^= VersionBuildDate.GetHashCode(); return hash; } @@ -297,6 +344,18 @@ namespace Tango.PMR.Diagnostics { dispenser7MotorFrequency_.WriteTo(output, _repeated_dispenser7MotorFrequency_codec); dispenser8MotorFrequency_.WriteTo(output, _repeated_dispenser8MotorFrequency_codec); digitalPins_.WriteTo(output, _repeated_digitalPins_codec); + if (Version.Length != 0) { + output.WriteRawTag(114); + output.WriteString(Version); + } + if (VersionName.Length != 0) { + output.WriteRawTag(122); + output.WriteString(VersionName); + } + if (VersionBuildDate.Length != 0) { + output.WriteRawTag(130, 1); + output.WriteString(VersionBuildDate); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -315,6 +374,15 @@ namespace Tango.PMR.Diagnostics { size += dispenser7MotorFrequency_.CalculateSize(_repeated_dispenser7MotorFrequency_codec); size += dispenser8MotorFrequency_.CalculateSize(_repeated_dispenser8MotorFrequency_codec); size += digitalPins_.CalculateSize(_repeated_digitalPins_codec); + if (Version.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); + } + if (VersionName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(VersionName); + } + if (VersionBuildDate.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(VersionBuildDate); + } return size; } @@ -336,6 +404,15 @@ namespace Tango.PMR.Diagnostics { dispenser7MotorFrequency_.Add(other.dispenser7MotorFrequency_); dispenser8MotorFrequency_.Add(other.dispenser8MotorFrequency_); digitalPins_.Add(other.digitalPins_); + if (other.Version.Length != 0) { + Version = other.Version; + } + if (other.VersionName.Length != 0) { + VersionName = other.VersionName; + } + if (other.VersionBuildDate.Length != 0) { + VersionBuildDate = other.VersionBuildDate; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -409,6 +486,18 @@ namespace Tango.PMR.Diagnostics { digitalPins_.AddEntriesFrom(input, _repeated_digitalPins_codec); break; } + case 114: { + Version = input.ReadString(); + break; + } + case 122: { + VersionName = input.ReadString(); + break; + } + case 130: { + VersionBuildDate = input.ReadString(); + break; + } } } } -- cgit v1.3.1 From 7ed962c7206817556e790d048bca38e4e3caf249 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 14 Feb 2018 11:47:21 +0200 Subject: Added code comments for technician module. --- .../TechItems/DigitalInItem.cs | 21 +++ .../TechItems/DigitalOutItem.cs | 27 ++++ .../TechItems/DispenserItem.cs | 62 +++++--- .../TechItems/MeterItem.cs | 37 ++++- .../TechItems/MonitorItem.cs | 27 ++++ .../TechItems/MotorActionType.cs | 3 + .../TechItems/MotorGroupItem.cs | 76 +++++++--- .../TechItems/MotorItem.cs | 62 +++++--- .../TechItems/MultiGraphItem.cs | 21 +++ .../TechItems/SingleGraphItem.cs | 21 +++ .../TechItems/TechItem.cs | 47 +++++- .../TechItems/TechItemAttribute.cs | 11 ++ .../TechItems/ThreadMotionItem.cs | 44 +++--- .../ViewModels/MachineTechViewVM.cs | 162 +++++++++++++++++++-- 14 files changed, 538 insertions(+), 83 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs index f6d09ae59..7f1548254 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalInItem.cs @@ -10,10 +10,17 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a digital input pin item. + /// + /// [TechItem(0)] public class DigitalInItem : TechItem { private TechIo _techIo; + /// + /// Gets or sets the DB tech item. + /// [XmlIgnore] public TechIo TechIo { @@ -22,6 +29,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _value; + /// + /// Gets or sets whether the input is on. + /// [XmlIgnore] public bool Value { @@ -29,6 +39,9 @@ namespace Tango.MachineStudio.Technician.TechItems set { _value = value; RaisePropertyChangedAuto(); } } + /// + /// Initializes a new instance of the class. + /// public DigitalInItem() : base() { Name = "Digital In"; @@ -37,11 +50,19 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; } + /// + /// Initializes a new instance of the class. + /// + /// The db tech. public DigitalInItem(TechIo techIo) : this() { TechIo = techIo; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { DigitalInItem cloned = base.Clone() as DigitalInItem; 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 index ae8a0a023..2a0625c53 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DigitalOutItem.cs @@ -10,12 +10,22 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a digital output pin item. + /// + /// [TechItem(1)] public class DigitalOutItem : TechItem { + /// + /// Occurs when the user has changed the current value. + /// public event EventHandler ValueChanged; private TechIo _techIo; + /// + /// Gets or sets the db tech item. + /// [XmlIgnore] public TechIo TechIo { @@ -24,6 +34,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _value; + /// + /// Gets or sets a value indicating whether this is on. + /// [XmlIgnore] public bool Value { @@ -32,6 +45,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _effectiveValue; + /// + /// Gets or sets the effective value received from the embedded device. + /// [XmlIgnore] public bool EffectiveValue { @@ -48,6 +64,9 @@ namespace Tango.MachineStudio.Technician.TechItems } } + /// + /// Initializes a new instance of the class. + /// public DigitalOutItem() : base() { Name = "Digital Out"; @@ -56,11 +75,19 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; } + /// + /// Initializes a new instance of the class. + /// + /// The db tech item. public DigitalOutItem(TechIo techIo) : this() { TechIo = techIo; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { DigitalOutItem cloned = base.Clone() as DigitalOutItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs index 8bb72fc66..e2ab9931d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -11,13 +11,27 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a dispenser controller item. + /// + /// [TechItem(8)] public class DispenserItem : TechItem { + /// + /// Occurs when the user has pressed one of the action controllers. + /// public event EventHandler ActionExecuted; + + /// + /// Occurs when dispenser homing has completed. + /// public event EventHandler HomingCompleted; private TechDispenser _techDispenser; + /// + /// Gets or sets the db tech dispenser. + /// [XmlIgnore] public TechDispenser TechDispenser { @@ -26,6 +40,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _isHoming; + /// + /// Gets or sets a value indicating whether the dispenser is currently homing. + /// [XmlIgnore] public bool IsHoming { @@ -38,7 +55,10 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _isHomingCompleted; - + /// + /// Gets or sets a value indicating whether the dispenser homing has completed. + /// + [XmlIgnore] public bool IsHomingCompleted { get { return _isHomingCompleted; } @@ -55,6 +75,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingProgress; + /// + /// Gets or sets the dispenser current homing progress. + /// [XmlIgnore] public double HomingProgress { @@ -67,6 +90,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingMaximumProgress; + /// + /// Gets or sets the homing maximum progress. + /// [XmlIgnore] public double HomingMaximumProgress { @@ -74,29 +100,19 @@ namespace Tango.MachineStudio.Technician.TechItems set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); } } - private bool _isForwardPressed; - [XmlIgnore] - public bool IsForwardPressed - { - get { return _isForwardPressed; } - set { _isForwardPressed = value; RaisePropertyChangedAuto(); } - } - - private bool _isBackwardPressed; - [XmlIgnore] - public bool IsBackwardPressed - { - get { return _isBackwardPressed; } - set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } - } - private double _speed; + /// + /// Gets or sets the dispenser motor speed. + /// public double Speed { get { return _speed; } set { _speed = value; RaisePropertyChangedAuto(); } } + /// + /// Initializes a new instance of the class. + /// public DispenserItem() : base() { Name = "Dispenser"; @@ -105,11 +121,19 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; } + /// + /// Initializes a new instance of the class. + /// + /// The tech dispenser. public DispenserItem(TechDispenser techDispenser) : this() { TechDispenser = techDispenser; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { DispenserItem cloned = base.Clone() as DispenserItem; @@ -117,6 +141,10 @@ namespace Tango.MachineStudio.Technician.TechItems return cloned; } + /// + /// Raises the event with the specified action. + /// + /// The action. public void RaiseAction(MotorActionType action) { ActionExecuted?.Invoke(this, action); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs index d7f019fa9..ce90859b2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs @@ -11,10 +11,17 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents an analog style VU meter item. + /// + /// [TechItem(3)] public class MeterItem : TechItem { private TechMonitor _techMonitor; + /// + /// Gets or sets the db tech monitor. + /// [XmlIgnore] public TechMonitor TechMonitor { @@ -23,6 +30,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _value; + /// + /// Gets or sets the current value. + /// [XmlIgnore] public double Value { @@ -31,6 +41,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private int _updateInterval; + /// + /// Gets or sets the minimum update interval. + /// public int UpdateInterval { get { return _updateInterval; } @@ -38,6 +51,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private int _ledCount; + /// + /// Gets or sets the amount of LED's. + /// public int LedCount { get { return _ledCount; } @@ -45,23 +61,34 @@ namespace Tango.MachineStudio.Technician.TechItems } private int _ticksCount; + /// + /// Gets or sets the amount of meter ticks. + /// public int TicksCount { get { return _ticksCount; } set { _ticksCount = value; RaisePropertyChangedAuto(); } } - private TickPlacement _tickPlacement; + /// + /// Gets or sets the ticks placement. + /// public TickPlacement TickPlacement { get { return _tickPlacement; } set { _tickPlacement = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the last update time. + /// [XmlIgnore] public DateTime LastUpdateTime { get; set; } + /// + /// Initializes a new instance of the class. + /// public MeterItem() : base() { Name = "VU Monitor"; @@ -75,11 +102,19 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.DimGray; } + /// + /// Initializes a new instance of the class. + /// + /// The db tech monitor. public MeterItem(TechMonitor techMonitor) : this() { TechMonitor = techMonitor; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { MeterItem cloned = base.Clone() as MeterItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs index 987c6cc99..984cd5f78 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs @@ -10,10 +10,17 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents an analog style integer monitor item. + /// + /// [TechItem(2)] public class MonitorItem : TechItem { private TechMonitor _techMonitor; + /// + /// Gets or sets the db tech monitor. + /// [XmlIgnore] public TechMonitor TechMonitor { @@ -22,6 +29,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _value; + /// + /// Gets or sets the current value. + /// [XmlIgnore] public double Value { @@ -30,15 +40,24 @@ namespace Tango.MachineStudio.Technician.TechItems } private int _updateInterval; + /// + /// Gets or sets the update interval. + /// public int UpdateInterval { get { return _updateInterval; } set { _updateInterval = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the last update time. + /// [XmlIgnore] public DateTime LastUpdateTime { get; set; } + /// + /// Initializes a new instance of the class. + /// public MonitorItem() : base() { Name = "Monitor"; @@ -49,11 +68,19 @@ namespace Tango.MachineStudio.Technician.TechItems UpdateInterval = 10; } + /// + /// Initializes a new instance of the class. + /// + /// The db tech monitor. public MonitorItem(TechMonitor techMonitor) : this() { TechMonitor = techMonitor; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { MonitorItem cloned = base.Clone() as MonitorItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs index 319345926..57dabbbb2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorActionType.cs @@ -6,6 +6,9 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents motor action types. + /// public enum MotorActionType { ForwardPressed, diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs index 551bf1f0a..143ce9c66 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs @@ -12,13 +12,27 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a motors group item. + /// + /// [TechItem(7)] public class MotorGroupItem : TechItem { + /// + /// Occurs when the user has pressed/released on of the item actions. + /// public event EventHandler ActionExecuted; + + /// + /// Occurs when motor homing has completed. + /// public event EventHandler HomingCompleted; private SelectedObjectCollection _selectedMotors; + /// + /// Gets or sets the selected db tech motors. + /// [XmlIgnore] public SelectedObjectCollection SelectedMotors { @@ -27,6 +41,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private ObservableCollection _techMotors; + /// + /// Gets or sets the available db tech motors. + /// [XmlIgnore] public ObservableCollection TechMotors { @@ -34,6 +51,9 @@ namespace Tango.MachineStudio.Technician.TechItems set { _techMotors = value; RaisePropertyChangedAuto(); SetSelectedMotors(); } } + /// + /// Sets the selected motors. + /// private void SetSelectedMotors() { if (TechMotors != null) @@ -42,18 +62,25 @@ namespace Tango.MachineStudio.Technician.TechItems } } + /// + /// Gets or sets the selected tech items motors guids. + /// public List ItemsGuids { get; set; } private String _groupName; - + /// + /// Gets or sets the name of the group. + /// public String GroupName { get { return _groupName; } set { _groupName = value; RaisePropertyChangedAuto(); TechName = value; } } - private bool _isHoming; + /// + /// Gets or sets a value indicating whether this motor group is currently homing. + /// [XmlIgnore] public bool IsHoming { @@ -66,7 +93,10 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _isHomingCompleted; - + /// + /// Gets or sets a value indicating whether this group homing has completed. + /// + [XmlIgnore] public bool IsHomingCompleted { get { return _isHomingCompleted; } @@ -83,6 +113,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingProgress; + /// + /// Gets or sets the current homing progress. + /// [XmlIgnore] public double HomingProgress { @@ -95,6 +128,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingMaximumProgress; + /// + /// Gets or sets the homing maximum progress. + /// [XmlIgnore] public double HomingMaximumProgress { @@ -102,29 +138,19 @@ namespace Tango.MachineStudio.Technician.TechItems set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); } } - private bool _isForwardPressed; - [XmlIgnore] - public bool IsForwardPressed - { - get { return _isForwardPressed; } - set { _isForwardPressed = value; RaisePropertyChangedAuto(); } - } - - private bool _isBackwardPressed; - [XmlIgnore] - public bool IsBackwardPressed - { - get { return _isBackwardPressed; } - set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } - } - private double _speed; + /// + /// Gets or sets the motors speed. + /// public double Speed { get { return _speed; } set { _speed = value; RaisePropertyChangedAuto(); } } + /// + /// Initializes a new instance of the class. + /// public MotorGroupItem() : base() { ItemsGuids = new List(); @@ -136,11 +162,19 @@ namespace Tango.MachineStudio.Technician.TechItems GroupName = "Motor Group"; } + /// + /// Initializes a new instance of the class. + /// + /// does not matter. public MotorGroupItem(object dummyConstructor) : this() { } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { MotorGroupItem cloned = base.Clone() as MotorGroupItem; @@ -151,6 +185,10 @@ namespace Tango.MachineStudio.Technician.TechItems return cloned; } + /// + /// Raises the event with the specified action. + /// + /// The action. public void RaiseAction(MotorActionType action) { ActionExecuted?.Invoke(this, action); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index ce668a464..2af7e6490 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -11,13 +11,27 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a motor controller item. + /// + /// [TechItem(6)] public class MotorItem : TechItem { + /// + /// Occurs when the user has pressed/released on of the item actions. + /// public event EventHandler ActionExecuted; + + /// + /// Occurs when motor homing has completed. + /// public event EventHandler HomingCompleted; private TechMotor _techMotor; + /// + /// Gets or sets the db tech motor. + /// [XmlIgnore] public TechMotor TechMotor { @@ -26,6 +40,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _isHoming; + /// + /// Gets or sets a value indicating whether the motor is currently homing. + /// [XmlIgnore] public bool IsHoming { @@ -38,7 +55,10 @@ namespace Tango.MachineStudio.Technician.TechItems } private bool _isHomingCompleted; - + /// + /// Gets or sets a value indicating whether the motor homing has completed. + /// + [XmlIgnore] public bool IsHomingCompleted { get { return _isHomingCompleted; } @@ -55,6 +75,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingProgress; + /// + /// Gets or sets the current homing progress. + /// [XmlIgnore] public double HomingProgress { @@ -67,6 +90,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private double _homingMaximumProgress; + /// + /// Gets or sets the homing maximum progress. + /// [XmlIgnore] public double HomingMaximumProgress { @@ -74,29 +100,19 @@ namespace Tango.MachineStudio.Technician.TechItems set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); } } - private bool _isForwardPressed; - [XmlIgnore] - public bool IsForwardPressed - { - get { return _isForwardPressed; } - set { _isForwardPressed = value; RaisePropertyChangedAuto(); } - } - - private bool _isBackwardPressed; - [XmlIgnore] - public bool IsBackwardPressed - { - get { return _isBackwardPressed; } - set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } - } - private double _speed; + /// + /// Gets or sets the motor speed. + /// public double Speed { get { return _speed; } set { _speed = value; RaisePropertyChangedAuto(); } } + /// + /// Initializes a new instance of the class. + /// public MotorItem() : base() { Name = "Motor"; @@ -105,11 +121,19 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; } + /// + /// Initializes a new instance of the class. + /// + /// The tech motor. public MotorItem(TechMotor techMotor) : this() { TechMotor = techMotor; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { MotorItem cloned = base.Clone() as MotorItem; @@ -118,6 +142,10 @@ namespace Tango.MachineStudio.Technician.TechItems return cloned; } + /// + /// Raises the event with the specified action. + /// + /// The action. public void RaiseAction(MotorActionType action) { ActionExecuted?.Invoke(this, action); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 65ee521ef..f74a4b02c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -10,10 +10,17 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a multi channel real-time graph item. + /// + /// [TechItem(5)] public class MultiGraphItem : TechItem { private TechMonitor _techMonitor; + /// + /// Gets or sets the db tech monitor. + /// [XmlIgnore] public TechMonitor TechMonitor { @@ -37,9 +44,15 @@ namespace Tango.MachineStudio.Technician.TechItems } } + /// + /// Gets or sets the item editor. + /// [XmlIgnore] public MultiGraphElementEditor Editor { get; set; } + /// + /// Initializes a new instance of the class. + /// public MultiGraphItem() : base() { Name = "Multi Channel Graph"; @@ -47,11 +60,19 @@ namespace Tango.MachineStudio.Technician.TechItems Image = ResourceHelper.GetImageFromResources("Images/multi-graph.png"); } + /// + /// Initializes a new instance of the class. + /// + /// The db tech monitor. public MultiGraphItem(TechMonitor techMonitor) : this() { TechMonitor = techMonitor; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { MultiGraphItem cloned = base.Clone() as MultiGraphItem; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 9d44c6a33..9b19f0861 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -10,10 +10,17 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a single channel real-time graph item. + /// + /// [TechItem(4)] public class SingleGraphItem : TechItem { private TechMonitor _techMonitor; + /// + /// Gets or sets the db tech monitor. + /// [XmlIgnore] public TechMonitor TechMonitor { @@ -36,9 +43,15 @@ namespace Tango.MachineStudio.Technician.TechItems } } + /// + /// Gets or sets the item editor. + /// [XmlIgnore] public SingleGraphElementEditor Editor { get; set; } + /// + /// Initializes a new instance of the class. + /// public SingleGraphItem() : base() { Name = "Single Channel Graph"; @@ -46,11 +59,19 @@ namespace Tango.MachineStudio.Technician.TechItems Image = ResourceHelper.GetImageFromResources("Images/single-graph.png"); } + /// + /// Initializes a new instance of the class. + /// + /// The db tech monitor. public SingleGraphItem(TechMonitor techMonitor) : this() { TechMonitor = techMonitor; } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { SingleGraphItem cloned = base.Clone() as SingleGraphItem; 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 a64cd7908..254c141b6 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,6 +14,10 @@ using System.Reflection; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a tech item base class. + /// + /// [XmlInclude(typeof(DispenserItem))] [XmlInclude(typeof(DigitalOutItem))] [XmlInclude(typeof(MeterItem))] @@ -26,6 +30,9 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(DigitalInItem))] public abstract class TechItem : ExtendedObject { + /// + /// Initializes a new instance of the class. + /// public TechItem() { ID = Guid.NewGuid().ToString(); @@ -35,6 +42,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private String _description; + /// + /// Gets or sets the description. + /// [XmlIgnore] public String Description { @@ -43,6 +53,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private BitmapSource _image; + /// + /// Gets or sets the image. + /// [XmlIgnore] public BitmapSource Image { @@ -50,6 +63,9 @@ namespace Tango.MachineStudio.Technician.TechItems set { _image = value; RaisePropertyChangedAuto(); } } + /// + /// Gets or sets the db adapter. + /// [XmlIgnore] public ObservablesEntitiesAdapter Adapter { get; set; } @@ -126,6 +142,9 @@ namespace Tango.MachineStudio.Technician.TechItems private String _techName; + /// + /// Gets or sets the tech item name. + /// [XmlIgnore] public String TechName { @@ -133,10 +152,15 @@ namespace Tango.MachineStudio.Technician.TechItems set { _techName = value; RaisePropertyChangedAuto(); } } - + /// + /// Gets or sets the db tech item guid. + /// public String ItemGuid { get; set; } private Color _color; + /// + /// Gets or sets the item color. + /// [XmlIgnore] public Color Color { @@ -150,7 +174,9 @@ namespace Tango.MachineStudio.Technician.TechItems } private int _colorNumber; - + /// + /// Gets or sets the color number (for XML serialization). + /// public int ColorNumber { get { return _colorNumber; } @@ -162,7 +188,10 @@ namespace Tango.MachineStudio.Technician.TechItems } } - + /// + /// Clones this instance. + /// + /// public virtual TechItem Clone() { TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem; @@ -175,6 +204,10 @@ namespace Tango.MachineStudio.Technician.TechItems return cloned; } + /// + /// Gets the available tech items. + /// + /// public static List GetAvailableTechItems() { List items = new List(); @@ -187,6 +220,10 @@ namespace Tango.MachineStudio.Technician.TechItems return items; } + /// + /// Sets the bounds. + /// + /// The bounds. public void SetBounds(Rect bounds) { Left = bounds.Left; @@ -195,6 +232,10 @@ namespace Tango.MachineStudio.Technician.TechItems Height = bounds.Height; } + /// + /// Gets the bounds. + /// + /// public Rect GetBounds() { return new Rect(Left, Top, Width, Height); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs index cd6dfb1ea..fafd00954 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItemAttribute.cs @@ -6,10 +6,21 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a tech item attribute + /// + /// public class TechItemAttribute : Attribute { + /// + /// Gets or sets the item index. + /// public int Index { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The index. public TechItemAttribute(int index) { Index = index; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs index 79ecf9372..a5789377f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ThreadMotionItem.cs @@ -9,34 +9,31 @@ using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Technician.TechItems { + /// + /// Represents a thread motion controller item. + /// + /// [TechItem(9)] public class ThreadMotionItem : TechItem { + /// + /// Occurs when the user has pressed/released on of the item actions. + /// public event EventHandler ActionExecuted; - private bool _isForwardPressed; - [XmlIgnore] - public bool IsForwardPressed - { - get { return _isForwardPressed; } - set { _isForwardPressed = value; RaisePropertyChangedAuto(); } - } - - private bool _isBackwardPressed; - [XmlIgnore] - public bool IsBackwardPressed - { - get { return _isBackwardPressed; } - set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } - } - private double _speed; + /// + /// Gets or sets the motor speed. + /// public double Speed { get { return _speed; } set { _speed = value; RaisePropertyChangedAuto(); } } + /// + /// Initializes a new instance of the class. + /// public ThreadMotionItem() : base() { Name = "Thread Motion"; @@ -46,17 +43,30 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; } - public ThreadMotionItem(object dummyConst) : this() + /// + /// Initializes a new instance of the class. + /// + /// Does not matter. + public ThreadMotionItem(object dummyConstructor) : this() { } + /// + /// Clones this instance. + /// + /// public override TechItem Clone() { ThreadMotionItem cloned = base.Clone() as ThreadMotionItem; + cloned.Speed = Speed; return cloned; } + /// + /// Raises the event with the specified action. + /// + /// The action. public void RaiseAction(MotorActionType action) { ActionExecuted?.Invoke(this, action); 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 2a55d12c6..6ccc1caa0 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 @@ -29,6 +29,11 @@ using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { + /// + /// Represents the MachineTechView View Model. + /// + /// + /// public class MachineTechViewVM : ViewModel, IShutdownListener { private List _diagnoticsDataProperties; @@ -139,22 +144,42 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Commands + /// + /// Gets or sets the save as project command. + /// public RelayCommand SaveAsProjectCommand { get; set; } + /// + /// Gets or sets the save project command. + /// public RelayCommand SaveProjectCommand { get; set; } + /// + /// Gets or sets the open project command. + /// public RelayCommand OpenProjectCommand { get; set; } #endregion #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + /// The notification provider. [PreferredConstructor] public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) : this(applicationManager, notificationProvider, true) { } + /// + /// Initializes a new instance of the class. + /// + /// The application manager. + /// The notification provider. + /// if set to true [load last project]. public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, bool loadLastProject) { _notification = notificationProvider; @@ -215,6 +240,10 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Populate Diagnostics Data + /// + /// Populates the diagnostics data to the proper elements. + /// + /// The data. private void PopulateDiagnosticsData(PushDiagnosticsResponse data) { if (DateTime.Now > _lastDiagnosticsResponseUpdate.AddMilliseconds(MIN_DIAGNOSTICS_UPDATE_MILI)) @@ -240,7 +269,7 @@ namespace Tango.MachineStudio.Technician.ViewModels if (prop != null) { - monitorItem.Value = GetLastMonitorValue(monitorItem.TechMonitor, prop.GetValue(data)); + monitorItem.Value = GetDataLastValue(monitorItem.TechMonitor, prop.GetValue(data)); } } } @@ -254,7 +283,7 @@ namespace Tango.MachineStudio.Technician.ViewModels if (prop != null) { - meterItem.Value = GetLastMonitorValue(meterItem.TechMonitor, prop.GetValue(data)); + meterItem.Value = GetDataLastValue(meterItem.TechMonitor, prop.GetValue(data)); } } } @@ -270,7 +299,7 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_singleControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetSingleGraphValues(graphItem.TechMonitor, prop.GetValue(data))); + controller.PushData(GetDataArray(graphItem.TechMonitor, prop.GetValue(data))); } } } @@ -286,7 +315,7 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_multiControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetMultiGraphValues(graphItem.TechMonitor, prop.GetValue(data))); + controller.PushData(GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data))); } } } @@ -320,7 +349,13 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Private Methods - private double GetLastMonitorValue(TechMonitor monitor, object value) + /// + /// Gets the last data point from a protobuf repeated field. + /// + /// The monitor. + /// The value. + /// + private double GetDataLastValue(TechMonitor monitor, object value) { if (!monitor.MultiChannel) { @@ -334,12 +369,24 @@ namespace Tango.MachineStudio.Technician.ViewModels } } - private List GetSingleGraphValues(TechMonitor monitor, object value) + /// + /// Gets the data array from a protobuf repeated field. + /// + /// The monitor. + /// The value. + /// + private List GetDataArray(TechMonitor monitor, object value) { return (value as RepeatedField).ToList(); } - private List> GetMultiGraphValues(TechMonitor monitor, object value) + /// + /// Gets the data matrix from a protobuf repeated field of . + /// + /// The monitor. + /// The value. + /// + private List> GetDataMatrix(TechMonitor monitor, object value) { DoubleArray[] arrayOfDoubles = Enumerable.ToArray(value as IEnumerable); return arrayOfDoubles.Select(x => x.Data.ToList()).ToList(); @@ -349,6 +396,9 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Virtual Methods + /// + /// Called when the disable rendering has been changed + /// protected virtual void OnDisableRenderingChanged() { foreach (var controller in _singleControllers) @@ -366,11 +416,20 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Add/Remove Element + /// + /// Creates a new tech element by the specified bounds and the current selected element. + /// + /// The bounds. public void CreateElement(Rect bounds) { CreateElement(SelectedTechItem, bounds); } + /// + /// Creates a new tech element by the specified tech item instance and bounds. + /// + /// The item. + /// The bounds. private void CreateElement(TechItem item, Rect bounds) { if (item is MonitorItem) @@ -422,6 +481,15 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + /// + /// Creates a new element by the specified editor type, tech item type, bounds and tech item constructor value. + /// + /// The type of the editor. + /// The type of the tech. + /// The type of the value. + /// The bounds. + /// The value. + /// private Editor CreateElement(Rect bounds, Value value) where Editor : IElementEditor where Tech : TechItem { TechItem item = Activator.CreateInstance(typeof(Tech), new object[] { value }) as TechItem; @@ -430,6 +498,12 @@ namespace Tango.MachineStudio.Technician.ViewModels return (Editor)editor; } + /// + /// Creates a new element by the specified editor type and tech item instance. + /// + /// The type of the editor. + /// The item. + /// private Editor CreateElement(TechItem item) where Editor : IElementEditor { IElementEditor editor = Activator.CreateInstance(typeof(Editor), new object[] { item, item.GetBounds() }) as IElementEditor; @@ -437,6 +511,10 @@ namespace Tango.MachineStudio.Technician.ViewModels return (Editor)editor; } + /// + /// Adds a new tech item. + /// + /// The item. private void AddTechItem(TechItem item) { if (item is MonitorItem) @@ -496,6 +574,10 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + /// + /// Called when elements have been removed + /// + /// The elements. public void OnElementsRemoved(List elements) { //foreach (var element in elements) @@ -513,6 +595,10 @@ namespace Tango.MachineStudio.Technician.ViewModels //} } + /// + /// Called when elements have been pasted + /// + /// The elements. public void OnElementsPasted(List elements) { foreach (var element in elements) @@ -585,6 +671,10 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Init Tech Items + /// + /// Initializes the motor item. + /// + /// The item. private void InitMotorItem(MotorItem item) { item.ActionExecuted += async (x, action) => @@ -655,6 +745,10 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the dispenser item. + /// + /// The item. private void InitDispenserItem(DispenserItem item) { item.ActionExecuted += async (x, action) => @@ -725,6 +819,11 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the single graph item. + /// + /// The item. + /// The editor. private void InitSingleGraphitem(SingleGraphItem item, SingleGraphElementEditor editor) { editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); @@ -736,6 +835,11 @@ namespace Tango.MachineStudio.Technician.ViewModels _singleControllers.Add(item, controller); } + /// + /// Initializes the multi graph item. + /// + /// The item. + /// The editor. private void InitMultiGraphItem(MultiGraphItem item, MultiGraphElementEditor editor) { editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(item.TechMonitor.PointsPerFrame); @@ -758,6 +862,10 @@ namespace Tango.MachineStudio.Technician.ViewModels _multiControllers.Add(item, controller); } + /// + /// Initializes the thread motion item. + /// + /// The item. private void InitThreadMotionItem(ThreadMotionItem item) { item.ActionExecuted += async (x, action) => @@ -783,6 +891,10 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the motor group item. + /// + /// The item. private void InitMotorGroupItem(MotorGroupItem item) { item.ActionExecuted += async (x, action) => @@ -853,6 +965,10 @@ namespace Tango.MachineStudio.Technician.ViewModels }; } + /// + /// Initializes the digital out item. + /// + /// The item. private void InitDigitalOutItem(DigitalOutItem item) { item.ValueChanged += async (x, value) => @@ -872,6 +988,9 @@ namespace Tango.MachineStudio.Technician.ViewModels #region Public Methods + /// + /// Opens a file open dialog to select a project file. + /// public void OpenProject() { OpenFileDialog dlg = new OpenFileDialog(); @@ -884,12 +1003,20 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + /// + /// Opens the specified project file path. + /// + /// File path. public void OpenProjectFile(String fileName) { LoadProject(MachineTechViewProject.Load(fileName)); _lastTechProjectFile = fileName; } + /// + /// Loads the specified project. + /// + /// The project. public void LoadProject(MachineTechViewProject project) { using (_notification.PushTaskItem("Loading technician project file...")) @@ -910,6 +1037,9 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + /// + /// Opens the file save dialog for selecting a project file target. + /// private void SaveAsProject() { SaveFileDialog dlg = new SaveFileDialog(); @@ -922,16 +1052,23 @@ namespace Tango.MachineStudio.Technician.ViewModels } } + /// + /// Saves the current project to the specified file path. + /// + /// Name of the file. private void SaveProjectFile(String fileName) { using (_notification.PushTaskItem("Saving technician project file...")) { - MachineTechViewProject project = CreateProjectFile(); + MachineTechViewProject project = GenerateProjectFile(); project.Save(fileName); _lastTechProjectFile = fileName; } } + /// + /// Saves the current opened project file. If not project file is opened will call . + /// private void SaveProject() { if (File.Exists(_lastTechProjectFile)) @@ -944,7 +1081,11 @@ namespace Tango.MachineStudio.Technician.ViewModels } } - private MachineTechViewProject CreateProjectFile() + /// + /// Generates a project file from the current element setup. + /// + /// + private MachineTechViewProject GenerateProjectFile() { MachineTechViewProject project = new MachineTechViewProject(); @@ -967,6 +1108,9 @@ namespace Tango.MachineStudio.Technician.ViewModels #region IShutdownListener + /// + /// Called when the application is about to terminate. + /// public void OnShuttingDown() { InvokeUINow(() => -- cgit v1.3.1