aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-09-17 18:01:34 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-09-17 18:01:34 +0300
commitfccf28feafb784d16603a8ce1cdeddc57be9471d (patch)
tree5805f33af71e78be124d1a58a0b90414484d33f2 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
parent09d6814981ea6103f27843aef998ae261269c632 (diff)
downloadTango-fccf28feafb784d16603a8ce1cdeddc57be9471d.tar.gz
Tango-fccf28feafb784d16603a8ce1cdeddc57be9471d.zip
Started working on tech heaters.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml94
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs102
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.pngbin0 -> 1136 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj13
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs82
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs1
6 files changed, 291 insertions, 1 deletions
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 @@
+<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.HeaterElementEditor"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
+ xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
+ xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals"
+ xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors"
+ mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:HeaterItem, IsDesignTimeCreatable=False}" Height="99.188" Width="163.459">
+
+ <UserControl.Resources>
+ <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
+ <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
+
+ <!--Theme-->
+ <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush>
+ <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush>
+ </UserControl.Resources>
+
+ <UserControl.RenderTransform>
+ <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform>
+ </UserControl.RenderTransform>
+
+ <Grid>
+
+
+ <!--Content-->
+ <Grid>
+
+ <Image Source="../Images/blower-big.png"></Image>
+
+ <Border Margin="0 0 0 -23" VerticalAlignment="Bottom">
+ <TextBlock Text="{Binding HardwareBlowerType.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock>
+ </Border>
+ </Grid>
+ <!--Content-->
+
+
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid>
+ <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
+
+ <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+ <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
+
+ <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10">
+ <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse>
+ <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle>
+ <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border>
+ <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border>
+ <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border>
+ <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+
+ <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8">
+ <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border>
+ <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
+ </Grid>
+ </Grid>
+ </Border>
+ </Grid>
+</local:ElementEditor>
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
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class.
+ /// </summary>
+ public HeaterElementEditor()
+ : base()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ public HeaterElementEditor(HeaterItem heaterItem)
+ : this()
+ {
+ HeaterItem = heaterItem;
+ DataContext = HeaterItem;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ /// <param name="bounds">The bounds.</param>
+ 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)); }
+ }
+
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns></returns>
+ 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);
+ }
+ }
+
+ /// <summary>
+ /// Gets the hosted element.
+ /// </summary>
+ [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
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/heater-controller.png
Binary files 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 @@
<Compile Include="Converters\TechIosToDigitalInsConverter.cs" />
<Compile Include="Converters\TechIosToDigitalOutsConverter.cs" />
<Compile Include="Converters\TransitionLinkConverter.cs" />
+ <Compile Include="Editors\HeaterElementEditor.xaml.cs">
+ <DependentUpon>HeaterElementEditor.xaml</DependentUpon>
+ </Compile>
<Compile Include="Editors\TextElementEditor.xaml.cs">
<DependentUpon>TextElementEditor.xaml</DependentUpon>
</Compile>
@@ -233,6 +236,7 @@
<Compile Include="TechItems\ControllerItem.cs" />
<Compile Include="TechItems\DigitalInItem.cs" />
<Compile Include="TechItems\DigitalOutItem.cs" />
+ <Compile Include="TechItems\HeaterItem.cs" />
<Compile Include="TechItems\JobRunnerItem.cs" />
<Compile Include="TechItems\MeterItem.cs" />
<Compile Include="TechItems\MotorActionType.cs" />
@@ -258,6 +262,10 @@
<Compile Include="Views\MachineTechView.xaml.cs">
<DependentUpon>MachineTechView.xaml</DependentUpon>
</Compile>
+ <Page Include="Editors\HeaterElementEditor.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Editors\TextElementEditor.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -634,10 +642,13 @@
<ItemGroup>
<Resource Include="Images\text.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\heater-controller.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ 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
+{
+ /// <summary>
+ /// Represents a heater controller.
+ /// </summary>
+ /// <seealso cref="Tango.MachineStudio.Technician.TechItems.TechItem" />
+ [TechItem(10)]
+ public class HeaterItem : TechItem
+ {
+ private TechHeater _techHeater;
+ /// <summary>
+ /// Gets or sets the db tech monitor.
+ /// </summary>
+ [XmlIgnore]
+ public TechHeater TechHeater
+ {
+ get { return _techHeater; }
+ set { _techHeater = value; RaisePropertyChangedAuto(); TechName = _techHeater != null ? _techHeater.Description : null; ItemGuid = value != null ? value.Guid : null; }
+ }
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HeaterItem"/> class.
+ /// </summary>
+ public HeaterItem() : base()
+ {
+ Name = "Heater Controller";
+ Color = Colors.White;
+ Description = "Heater Controller";
+ Image = ResourceHelper.GetImageFromResources("Images/heater-controller.png");
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HeaterItem"/> class.
+ /// </summary>
+ /// <param name="TechHeater">The db tech monitor.</param>
+ public HeaterItem(TechHeater techHeater) : this()
+ {
+ TechHeater = techHeater;
+ }
+
+ private HeaterState _heaterState;
+ /// <summary>
+ /// Gets or sets the state of the heater.
+ /// </summary>
+ public HeaterState HeaterState
+ {
+ get { return _heaterState; }
+ set { _heaterState = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _setPoint;
+ /// <summary>
+ /// Gets or sets the set point.
+ /// </summary>
+ public double SetPoint
+ {
+ get { return _setPoint; }
+ set { _setPoint = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns></returns>
+ 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
{
/// <summary>