diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-08-06 16:12:38 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-08-06 16:12:38 +0300 |
| commit | 778408ff6140099aace10a915bc0296d71f967fe (patch) | |
| tree | 40bbfabe96128d777f793f0b8d14b059d0f88ce2 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems | |
| parent | 65d06cf7d023cfed8a1619cb2f81279b1d5096f8 (diff) | |
| parent | ce34a07e9ae75c9172425322248dc2fd1754852e (diff) | |
| download | Tango-778408ff6140099aace10a915bc0296d71f967fe.tar.gz Tango-778408ff6140099aace10a915bc0296d71f967fe.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems')
5 files changed, 256 insertions, 22 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs new file mode 100644 index 000000000..59a96f107 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs @@ -0,0 +1,102 @@ +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.BL.Entities; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// <summary> + /// Represents a Blower controller item. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Technician.TechItems.TechItem" /> + [TechItem(16)] + public class BlowerItem : TechItem + { + private static List<HardwareBlower> _BlowerConfigurations; + /// <summary> + /// Gets or sets the Blower configurations. + /// </summary> + public static List<HardwareBlower> BlowerConfigurations + { + get { return _BlowerConfigurations; } + set { _BlowerConfigurations = value; } + } + + static BlowerItem() + { + BlowerConfigurations = new List<HardwareBlower>(); + + foreach (var BlowerType in BL.ObservablesEntitiesAdapter.Instance.HardwareBlowerTypes) + { + BlowerConfigurations.Add(new HardwareBlower() { HardwareBlowerType = BlowerType }); + } + } + + private HardwareBlowerType _hardwareBlowerType; + /// <summary> + /// Gets or sets the type of the hardware Blower. + /// </summary> + [XmlIgnore] + public HardwareBlowerType HardwareBlowerType + { + get { return _hardwareBlowerType; } + set + { + _hardwareBlowerType = value; RaisePropertyChangedAuto(); TechName = _hardwareBlowerType != null ? _hardwareBlowerType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareBlowerType != null) + { + HardwareBlower = BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType == _hardwareBlowerType); + } + } + } + + private HardwareBlower _hardwareBlower; + /// <summary> + /// Gets or sets the hardware Blower. + /// </summary> + [XmlIgnore] + public HardwareBlower HardwareBlower + { + get { return _hardwareBlower; } + set { _hardwareBlower = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="BlowerItem"/> class. + /// </summary> + public BlowerItem() : base() + { + Name = "Blower"; + Description = "Blower Controller"; + Image = ResourceHelper.GetImageFromResources("Images/blower.png"); + Color = Colors.White; + HardwareBlower = new HardwareBlower(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="BlowerItem"/> class. + /// </summary> + /// <param name="BlowerType">Type of the Blower.</param> + public BlowerItem(HardwareBlowerType BlowerType) : this() + { + HardwareBlowerType = BlowerType; + } + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override TechItem Clone() + { + BlowerItem cloned = base.Clone() as BlowerItem; + cloned.HardwareBlowerType = HardwareBlowerType; + return cloned; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs new file mode 100644 index 000000000..cf1ed682e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs @@ -0,0 +1,102 @@ +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.BL.Entities; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// <summary> + /// Represents a BreakSensor controller item. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Technician.TechItems.TechItem" /> + [TechItem(17)] + public class BreakSensorItem : TechItem + { + private static List<HardwareBreakSensor> _BreakSensorConfigurations; + /// <summary> + /// Gets or sets the BreakSensor configurations. + /// </summary> + public static List<HardwareBreakSensor> BreakSensorConfigurations + { + get { return _BreakSensorConfigurations; } + set { _BreakSensorConfigurations = value; } + } + + static BreakSensorItem() + { + BreakSensorConfigurations = new List<HardwareBreakSensor>(); + + foreach (var BreakSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareBreakSensorTypes) + { + BreakSensorConfigurations.Add(new HardwareBreakSensor() { HardwareBreakSensorType = BreakSensorType }); + } + } + + private HardwareBreakSensorType _hardwareBreakSensorType; + /// <summary> + /// Gets or sets the type of the hardware BreakSensor. + /// </summary> + [XmlIgnore] + public HardwareBreakSensorType HardwareBreakSensorType + { + get { return _hardwareBreakSensorType; } + set + { + _hardwareBreakSensorType = value; RaisePropertyChangedAuto(); TechName = _hardwareBreakSensorType != null ? _hardwareBreakSensorType.Description : null; ItemGuid = value != null ? value.Guid : null; + + if (_hardwareBreakSensorType != null) + { + HardwareBreakSensor = BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType == _hardwareBreakSensorType); + } + } + } + + private HardwareBreakSensor _hardwareBreakSensor; + /// <summary> + /// Gets or sets the hardware BreakSensor. + /// </summary> + [XmlIgnore] + public HardwareBreakSensor HardwareBreakSensor + { + get { return _hardwareBreakSensor; } + set { _hardwareBreakSensor = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="BreakSensorItem"/> class. + /// </summary> + public BreakSensorItem() : base() + { + Name = "Break Sensor"; + Description = "Break Sensor Controller"; + Image = ResourceHelper.GetImageFromResources("Images/break.png"); + Color = Colors.White; + HardwareBreakSensor = new HardwareBreakSensor(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="BreakSensorItem"/> class. + /// </summary> + /// <param name="BreakSensorType">Type of the BreakSensor.</param> + public BreakSensorItem(HardwareBreakSensorType BreakSensorType) : this() + { + HardwareBreakSensorType = BreakSensorType; + } + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override TechItem Clone() + { + BreakSensorItem cloned = base.Clone() as BreakSensorItem; + cloned.HardwareBreakSensorType = HardwareBreakSensorType; + return cloned; + } + } +} 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 d4bdfb7b2..5a3bd0327 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 @@ -79,16 +79,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _max = value; RaisePropertyChangedAuto(); } } - private bool _useMinMax; - /// <summary> - /// Gets or sets a value indicating whether [use minimum maximum]. - /// </summary> - public bool UseMinMax - { - get { return _useMinMax; } - set { _useMinMax = value; RaisePropertyChangedAuto(); } - } - private bool _useAutoRange; /// <summary> /// Gets or sets a value indicating whether [use automatic range]. @@ -144,6 +134,12 @@ namespace Tango.MachineStudio.Technician.TechItems public RelayCommand ToggleRecordingCommand { get; set; } /// <summary> + /// Gets or sets the reset minimum maximum to default command. + /// </summary> + [XmlIgnore] + public RelayCommand ResetMinMaxToDefaultCommand { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="MultiGraphItem"/> class. /// </summary> public MultiGraphItem() : base() @@ -166,6 +162,24 @@ namespace Tango.MachineStudio.Technician.TechItems }); ToggleRecordingCommand = new RelayCommand(ToggleRecording); + + ResetMinMaxToDefaultCommand = new RelayCommand(() => + { + if (TechMonitor != null) + { + Min = TechMonitor.Min; + Max = TechMonitor.Max; + } + }); + } + + private void OnTechMonitorChanged() + { + if (TechMonitor != null) + { + Min = TechMonitor.Min; + Max = TechMonitor.Max; + } } private void _timer_Tick(object sender, EventArgs e) @@ -210,7 +224,6 @@ namespace Tango.MachineStudio.Technician.TechItems cloned.TechMonitor = TechMonitor; cloned.Min = Min; cloned.Max = Max; - cloned.UseMinMax = UseMinMax; cloned.UseAutoRange = UseAutoRange; return cloned; } 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 c175f1138..aa404b215 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 @@ -50,6 +50,8 @@ namespace Tango.MachineStudio.Technician.TechItems ItemGuid = value != null ? value.Guid : null; TechName = _techMonitor != null ? _techMonitor.Description : null; + + OnTechMonitorChanged(); } } @@ -79,16 +81,6 @@ namespace Tango.MachineStudio.Technician.TechItems set { _max = value; RaisePropertyChangedAuto(); } } - private bool _useMinMax; - /// <summary> - /// Gets or sets a value indicating whether [use minimum maximum]. - /// </summary> - public bool UseMinMax - { - get { return _useMinMax; } - set { _useMinMax = value; RaisePropertyChangedAuto(); } - } - private bool _useAutoRange; /// <summary> /// Gets or sets a value indicating whether [use automatic range]. @@ -144,6 +136,12 @@ namespace Tango.MachineStudio.Technician.TechItems public RelayCommand ToggleRecordingCommand { get; set; } /// <summary> + /// Gets or sets the reset minimum maximum to default command. + /// </summary> + [XmlIgnore] + public RelayCommand ResetMinMaxToDefaultCommand { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="SingleGraphItem"/> class. /// </summary> public SingleGraphItem() : base() @@ -166,6 +164,15 @@ namespace Tango.MachineStudio.Technician.TechItems }); ToggleRecordingCommand = new RelayCommand(ToggleRecording); + + ResetMinMaxToDefaultCommand = new RelayCommand(() => + { + if (TechMonitor != null) + { + Min = TechMonitor.Min; + Max = TechMonitor.Max; + } + }); } private void _timer_Tick(object sender, EventArgs e) @@ -200,6 +207,15 @@ namespace Tango.MachineStudio.Technician.TechItems TechMonitor = techMonitor; } + private void OnTechMonitorChanged() + { + if (TechMonitor != null) + { + Min = TechMonitor.Min; + Max = TechMonitor.Max; + } + } + /// <summary> /// Clones this instance. /// </summary> @@ -210,7 +226,6 @@ namespace Tango.MachineStudio.Technician.TechItems cloned.TechMonitor = TechMonitor; cloned.Min = Min; cloned.Max = Max; - cloned.UseMinMax = UseMinMax; cloned.UseAutoRange = UseAutoRange; return cloned; } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index a1aba597b..11188c69d 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 @@ -34,6 +34,8 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(WinderItem))] [XmlInclude(typeof(DancerItem))] [XmlInclude(typeof(SpeedSensorItem))] + [XmlInclude(typeof(BlowerItem))] + [XmlInclude(typeof(BreakSensorItem))] [XmlInclude(typeof(ProcessParametersItem))] [XmlInclude(typeof(JobRunnerItem))] public abstract class TechItem : ExtendedObject |
