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! --- .../TechItems/ControllerItem.cs | 42 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems') 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