From f70d2639099282432295c0949fe6da2c8dd4bb46 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 20 Mar 2018 12:34:34 +0200 Subject: Improved Tech Single Value Controller! --- .../Editors/ControllerElementEditor.xaml | 52 +++++++++++----------- .../PropertiesTemplates/ControllerTemplate.xaml | 3 ++ .../TechItems/ControllerItem.cs | 42 ++++++++++++++++- 3 files changed, 69 insertions(+), 28 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml index 60b96bc9d..5cffffc90 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml @@ -30,12 +30,13 @@ - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml index 57d807b09..ffc726abf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ControllerTemplate.xaml @@ -34,6 +34,9 @@ + + Optimal Range: to + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs index 67266ee66..8a9cba883 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ControllerItem.cs @@ -30,7 +30,19 @@ namespace Tango.MachineStudio.Technician.TechItems public TechController TechController { get { return _techController; } - set { _techController = value; RaisePropertyChangedAuto(); TechName = _techController != null ? _techController.Description : null; ItemGuid = value != null ? value.Guid : null; } + set + { + _techController = value; + RaisePropertyChangedAuto(); + TechName = _techController != null ? _techController.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_techController != null && !IsSetToDefault) + { + OptimalRangeMinimum = _techController.Min; + OptimalRangeMaximum = _techController.Min + ((_techController.Max - _techController.Min) * 0.7d); + IsSetToDefault = true; + } + } } private double _value; @@ -64,7 +76,6 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public DateTime LastUpdateTime { get; set; } - private double _effectiveValue; /// /// Gets or sets the effective value received from the embedded device. @@ -85,6 +96,29 @@ namespace Tango.MachineStudio.Technician.TechItems } } + private double _optimalRangeMinimum; + /// + /// Gets or sets the optimal range. + /// + public double OptimalRangeMinimum + { + get { return _optimalRangeMinimum; } + set + { + _optimalRangeMinimum = value; + RaisePropertyChangedAuto(); + } + } + + private double _optimalRangeMaximum; + public double OptimalRangeMaximum + { + get { return _optimalRangeMaximum; } + set { _optimalRangeMaximum = value; RaisePropertyChangedAuto(); } + } + + public bool IsSetToDefault { get; set; } + /// /// Initializes a new instance of the class. /// @@ -115,6 +149,10 @@ namespace Tango.MachineStudio.Technician.TechItems { ControllerItem cloned = base.Clone() as ControllerItem; cloned.TechController = TechController; + cloned.OptimalRangeMinimum = OptimalRangeMinimum; + cloned.OptimalRangeMaximum = OptimalRangeMaximum; + cloned.IsSetToDefault = IsSetToDefault; + return cloned; } } -- cgit v1.3.1