From fccf28feafb784d16603a8ce1cdeddc57be9471d Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 17 Sep 2018 18:01:34 +0300 Subject: Started working on tech heaters. --- .../Editors/HeaterElementEditor.xaml | 94 +++++++++++++++++++ .../Editors/HeaterElementEditor.xaml.cs | 102 +++++++++++++++++++++ .../Images/heater-controller.png | Bin 0 -> 1136 bytes .../Tango.MachineStudio.Technician.csproj | 13 ++- .../TechItems/HeaterItem.cs | 82 +++++++++++++++++ .../TechItems/TechItem.cs | 1 + 6 files changed, 291 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml new file mode 100644 index 000000000..f72c5ad08 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs new file mode 100644 index 000000000..b0b28454a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs @@ -0,0 +1,102 @@ +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.BL.Entities; +using Tango.MachineStudio.Technician.TechItems; +using Tango.Core; + +namespace Tango.MachineStudio.Technician.Editors +{ + [ContentProperty("InnerContent")] + public partial class HeaterElementEditor : ElementEditor + { + /// + /// Initializes a new instance of the class. + /// + public HeaterElementEditor() + : base() + { + InitializeComponent(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + public HeaterElementEditor(HeaterItem heaterItem) + : this() + { + HeaterItem = heaterItem; + DataContext = HeaterItem; + } + + /// + /// Initializes a new instance of the class. + /// + /// The framework element. + /// The bounds. + public HeaterElementEditor(HeaterItem heaterItem, Rect bounds) + : this(heaterItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private HeaterItem _heaterItem; + public HeaterItem HeaterItem + { + get { return _heaterItem; } + set { _heaterItem = value; RaisePropertyChanged(nameof(HeaterItem)); } + } + + + /// + /// Clones this instance. + /// + /// + public override IElementEditor Clone() + { + try + { + var clonedItem = HeaterItem.Clone() as HeaterItem; + HeaterElementEditor cloned = new HeaterElementEditor(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 HeaterItem; } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png new file mode 100644 index 000000000..71d6698ec Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png differ 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 73039bc4b..21fcf3e24 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 @@ -100,6 +100,9 @@ + + HeaterElementEditor.xaml + TextElementEditor.xaml @@ -233,6 +236,7 @@ + @@ -258,6 +262,10 @@ MachineTechView.xaml + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -634,10 +642,13 @@ + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs new file mode 100644 index 000000000..e1221e1f2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs @@ -0,0 +1,82 @@ +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.PMR.Diagnostics; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + /// + /// Represents a heater controller. + /// + /// + [TechItem(10)] + public class HeaterItem : TechItem + { + private TechHeater _techHeater; + /// + /// Gets or sets the db tech monitor. + /// + [XmlIgnore] + public TechHeater TechHeater + { + get { return _techHeater; } + set { _techHeater = value; RaisePropertyChangedAuto(); TechName = _techHeater != null ? _techHeater.Description : null; ItemGuid = value != null ? value.Guid : null; } + } + /// + /// Initializes a new instance of the class. + /// + public HeaterItem() : base() + { + Name = "Heater Controller"; + Color = Colors.White; + Description = "Heater Controller"; + Image = ResourceHelper.GetImageFromResources("Images/heater-controller.png"); + } + + /// + /// Initializes a new instance of the class. + /// + /// The db tech monitor. + public HeaterItem(TechHeater techHeater) : this() + { + TechHeater = techHeater; + } + + private HeaterState _heaterState; + /// + /// Gets or sets the state of the heater. + /// + public HeaterState HeaterState + { + get { return _heaterState; } + set { _heaterState = value; RaisePropertyChangedAuto(); } + } + + private double _setPoint; + /// + /// Gets or sets the set point. + /// + public double SetPoint + { + get { return _setPoint; } + set { _setPoint = value; RaisePropertyChangedAuto(); } + } + + /// + /// Clones this instance. + /// + /// + public override TechItem Clone() + { + HeaterItem cloned = base.Clone() as HeaterItem; + cloned.TechHeater = TechHeater; + 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 04b6c1fab..0d7568d68 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 @@ -39,6 +39,7 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlInclude(typeof(ProcessParametersItem))] [XmlInclude(typeof(JobRunnerItem))] [XmlInclude(typeof(TextItem))] + [XmlInclude(typeof(HeaterItem))] public abstract class TechItem : ExtendedObject { /// -- cgit v1.3.1