aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-08 19:22:42 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-08 19:22:42 +0200
commit6103db0f792e396583929c08117e07fb6b9aa389 (patch)
treeb7606b44cce5c3b224ddba8ac6491aff48438b50 /Software/Visual_Studio/MachineStudio/Modules
parenta1432b11d087a4b2f4530504e18434225b36bf48 (diff)
downloadTango-6103db0f792e396583929c08117e07fb6b9aa389.tar.gz
Tango-6103db0f792e396583929c08117e07fb6b9aa389.zip
Working on MachineTechView...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs34
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs27
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml79
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs102
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.pngbin0 -> 7334 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.pngbin0 -> 1842 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.pngbin0 -> 4236 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml22
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml22
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs (renamed from Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs)14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs60
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs (renamed from Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs)41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs153
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml94
19 files changed, 698 insertions, 47 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs
new file mode 100644
index 000000000..b5f9cffef
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/MonitorsToSingleChannleMonitorsConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using Tango.Integration.Observables;
+
+namespace Tango.MachineStudio.Technician.Converters
+{
+ public class MonitorsToSingleChannleMonitorsConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ ObservableCollection<TechMonitor> monitors = value as ObservableCollection<TechMonitor>;
+
+ if (monitors != null)
+ {
+ return monitors.Where(x => !x.MultiChannel).ToObservableCollection();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
index d3ce4fc10..84eae5f75 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
@@ -33,7 +33,7 @@
<ImageBrush ImageSource="../Images/black-screen.jpg" />
</Border.Background>
- <TextBlock FontFamily="../Fonts/#digital-7" TextAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="90" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Value,FallbackValue='0000'}"></TextBlock>
+ <TextBlock FontFamily="../Fonts/#digital-7" TextAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="90" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=MonitorItem.Value,FallbackValue='0000'}"></TextBlock>
</Border>
</Grid>
</StackPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs
index f50fc9039..c11ca4417 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml.cs
@@ -17,35 +17,10 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.Editors;
using Tango.Integration.Observables;
-using Tango.MachineStudio.Technician.Items;
+using Tango.MachineStudio.Technician.TechItems;
namespace Tango.MachineStudio.Technician.Editors
{
- /// <summary>
- /// <para><img class="classImage" src="../Media/MonitorElementEditor.png" /></para>
- /// Represents a <see cref="FrameworkElement"/> editor with position, size and angle control.
- /// </summary>
- /// <example>
- /// <para class="example-title">
- /// <img class="exampleIcon" src="../Icons/CodeExample.png" />
- /// <i>
- /// The following example demonstrates a basic scenario of using <see cref="N:WpfVideoTools.Tiles"/> and <see cref="N:Tango.Editors"/> by creating a simple video projection application with the following features:
- /// </i>
- /// <list type="bullet">
- /// <item>Use the mouse to draw any type of tile of the editor surface.</item>
- /// <item>Apply any input shape on any tile.</item>
- /// <item>Load any video and display it on any of the selected tile.</item>
- /// <item>Built in support for undo, redo, cut, copy and paste, delete and select operations.</item>
- /// <item>Built in support for saving/loading the editor state to memory or file.</item>
- /// <item>Built in support for tile and editor properties adjustment using the <see cref="ParameterizedEditor"/>.</item>
- /// </list>
- /// </para>
- /// <para><markup><video class="exampleVideo" autoplay="autoplay" loop="loop" controls="controls" src="../Media/EditorsExample.mp4"></video></markup></para>
- /// <code lang="XAML" source="../FullAPIExamples/Examples/Editors/EditorsExample.xaml" title="Elements editor example." />
- /// <i>Code-Behind.</i>
- /// <code lang="C#" source="../FullAPIExamples/Examples/Editors/EditorsExample.xaml.cs" title="Elements editor example." />
- /// </example>
- /// <seealso cref="Tango.Editors.ElementEditor" />
[ContentProperty("InnerContent")]
public partial class MonitorElementEditor : ElementEditor
{
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
new file mode 100644
index 000000000..eafc7b5d3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
@@ -0,0 +1,79 @@
+<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.SingleGraphElementEditor"
+ 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:controls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common"
+ xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
+ xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors"
+ mc:Ignorable="d"
+ d:DesignHeight="150" d:DesignWidth="400" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
+
+ <!--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>
+ <!--<Viewbox Stretch="Fill">-->
+ <controls:RealTimeGraphControl x:Name="InnerGraph" x:FieldModifier="public" IsHitTestVisible="False" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" />
+ <!--</Viewbox>-->
+
+ <Border Margin="0 0 0 -23" VerticalAlignment="Bottom">
+ <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=MonitorItem.TechMonitor.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}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <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/SingleGraphElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml.cs
new file mode 100644
index 000000000..8e8ac556e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.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.Integration.Observables;
+using Tango.MachineStudio.Technician.TechItems;
+
+namespace Tango.MachineStudio.Technician.Editors
+{
+ [ContentProperty("InnerContent")]
+ public partial class SingleGraphElementEditor : ElementEditor
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GraphElementEditor"/> class.
+ /// </summary>
+ public SingleGraphElementEditor()
+ : base()
+ {
+ InitializeComponent();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GraphElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ public SingleGraphElementEditor(SingleGraphItem graphItem)
+ : this()
+ {
+ GraphItem = graphItem;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GraphElementEditor"/> class.
+ /// </summary>
+ /// <param name="frameworkElement">The framework element.</param>
+ /// <param name="bounds">The bounds.</param>
+ public SingleGraphElementEditor(SingleGraphItem graphItem, Rect bounds)
+ : this(graphItem)
+ {
+ Left = bounds.Left;
+ Top = bounds.Top;
+ Width = bounds.Width;
+ Height = bounds.Height;
+ }
+
+ private SingleGraphItem _monitorItem;
+
+ public SingleGraphItem GraphItem
+ {
+ get { return _monitorItem; }
+ set { _monitorItem = value; RaisePropertyChanged(nameof(GraphItem)); }
+ }
+
+
+ /// <summary>
+ /// Clones this instance.
+ /// </summary>
+ /// <returns></returns>
+ public override IElementEditor Clone()
+ {
+ try
+ {
+ SingleGraphElementEditor cloned = new SingleGraphElementEditor();
+
+ cloned.GraphItem = GraphItem.Clone() as SingleGraphItem;
+ 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 GraphItem; }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png
new file mode 100644
index 000000000..2651a64b0
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/analog.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png
new file mode 100644
index 000000000..0aca05e00
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/graph.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png
new file mode 100644
index 000000000..f72f56a87
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/single-graph.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml
new file mode 100644
index 000000000..66e0e5cba
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml
@@ -0,0 +1,22 @@
+<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.MonitorTemplate"
+ 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:converters="clr-namespace:Tango.MachineStudio.Technician.Converters"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates"
+ mc:Ignorable="d"
+ d:DesignHeight="300" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:MonitorItem, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <StackPanel>
+ <TextBlock FontSize="10">Selected Input</TextBlock>
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechMonitors,Converter={StaticResource MonitorsToSingleChannleMonitorsConverter}}" SelectedItem="{Binding TechMonitor,Mode=TwoWay}" DisplayMemberPath="Description" />
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs
new file mode 100644
index 000000000..8b5396ffc
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MonitorTemplate.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.Technician.PropertiesTemplates
+{
+ /// <summary>
+ /// Interaction logic for MonitorTemplate.xaml
+ /// </summary>
+ public partial class MonitorTemplate : UserControl
+ {
+ public MonitorTemplate()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
new file mode 100644
index 000000000..098e7a3dd
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
@@ -0,0 +1,22 @@
+<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.SingleGraphTemplate"
+ 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:converters="clr-namespace:Tango.MachineStudio.Technician.Converters"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates"
+ mc:Ignorable="d"
+ d:DesignHeight="300" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:SingleGraphItem, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <StackPanel>
+ <TextBlock FontSize="10">Selected Input</TextBlock>
+ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechMonitors,Converter={StaticResource MonitorsToSingleChannleMonitorsConverter}}" SelectedItem="{Binding TechMonitor,Mode=TwoWay}" DisplayMemberPath="Description" />
+ </StackPanel>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs
new file mode 100644
index 000000000..4ccb703b4
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.MachineStudio.Technician.TechItems;
+
+namespace Tango.MachineStudio.Technician.PropertiesTemplates
+{
+ /// <summary>
+ /// Interaction logic for SingleGraphTemplate.xaml
+ /// </summary>
+ public partial class SingleGraphTemplate : UserControl
+ {
+ public SingleGraphTemplate()
+ {
+ InitializeComponent();
+ }
+ }
+}
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 6d3ae9c1a..05ab7cc38 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
@@ -77,14 +77,25 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Converters\MonitorsToSingleChannleMonitorsConverter.cs" />
<Compile Include="Converters\SecondsToGraphPointsConverter.cs" />
<Compile Include="Converters\TransitionLinkConverter.cs" />
+ <Compile Include="Editors\SingleGraphElementEditor.xaml.cs">
+ <DependentUpon>SingleGraphElementEditor.xaml</DependentUpon>
+ </Compile>
<Compile Include="Editors\MonitorElementEditor.xaml.cs">
<DependentUpon>MonitorElementEditor.xaml</DependentUpon>
</Compile>
<Compile Include="Helpers\GraphsHelper.cs" />
- <Compile Include="Items\MonitorItem.cs" />
- <Compile Include="Items\TechItem.cs" />
+ <Compile Include="PropertiesTemplates\MonitorTemplate.xaml.cs">
+ <DependentUpon>MonitorTemplate.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="PropertiesTemplates\SingleGraphTemplate.xaml.cs">
+ <DependentUpon>SingleGraphTemplate.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="TechItems\SingleGraphItem.cs" />
+ <Compile Include="TechItems\MonitorItem.cs" />
+ <Compile Include="TechItems\TechItem.cs" />
<Compile Include="Navigation\TechNavigationView.cs" />
<Compile Include="Navigation\TechNavigationManager.cs" />
<Compile Include="TechnicianModule.cs" />
@@ -110,10 +121,22 @@
<Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Page Include="Editors\SingleGraphElementEditor.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Editors\MonitorElementEditor.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="PropertiesTemplates\MonitorTemplate.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="PropertiesTemplates\SingleGraphTemplate.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Resources\GraphEx.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -213,5 +236,14 @@
<ItemGroup>
<Resource Include="Images\black-screen.jpg" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\analog.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\graph.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\single-graph.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs
index 4150e3784..cc1ca4083 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/MonitorItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MonitorItem.cs
@@ -3,29 +3,37 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Serialization;
using Tango.Integration.Observables;
+using Tango.SharedUI.Helpers;
-namespace Tango.MachineStudio.Technician.Items
+namespace Tango.MachineStudio.Technician.TechItems
{
public class MonitorItem : TechItem
{
private TechMonitor _techMonitor;
+ [XmlIgnore]
public TechMonitor TechMonitor
{
get { return _techMonitor; }
- set { _techMonitor = value; RaisePropertyChangedAuto(); }
+ set { _techMonitor = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); }
}
private double _value;
+ [XmlIgnore]
public double Value
{
get { return _value; }
set { _value = value; RaisePropertyChanged(nameof(Value)); }
}
+ public override object Data => TechMonitor;
+
public MonitorItem() : base()
{
-
+ Name = "Monitor";
+ Description = "Simple analogue like monitor";
+ Image = ResourceHelper.GetImageFromResources("Images/analog.png");
}
public MonitorItem(TechMonitor techMonitor) : this()
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
new file mode 100644
index 000000000..9ce559047
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+using Tango.Integration.Observables;
+using Tango.MachineStudio.Technician.Editors;
+using Tango.SharedUI.Helpers;
+
+namespace Tango.MachineStudio.Technician.TechItems
+{
+ public class SingleGraphItem : TechItem
+ {
+ private TechMonitor _techMonitor;
+ [XmlIgnore]
+ public TechMonitor TechMonitor
+ {
+ get { return _techMonitor; }
+ set
+ {
+ TechMonitor old = _techMonitor;
+
+ _techMonitor = value;
+ RaisePropertyChangedAuto();
+ RaisePropertyChanged(nameof(Data));
+
+ if (_techMonitor != old && Editor != null)
+ {
+ Editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(TechMonitor.PointsPerFrame);
+ Editor.InnerGraph.InvalidateGraph();
+ }
+ }
+ }
+
+ [XmlIgnore]
+ public SingleGraphElementEditor Editor { get; set; }
+
+ public override object Data => TechMonitor;
+
+ public SingleGraphItem() : base()
+ {
+ Name = "Single Channel Graph";
+ Description = "Single channel real-time graph";
+ Image = ResourceHelper.GetImageFromResources("Images/single-graph.png");
+ }
+
+ public SingleGraphItem(TechMonitor techMonitor) : this()
+ {
+ TechMonitor = techMonitor;
+ }
+
+ public override TechItem Clone()
+ {
+ MonitorItem cloned = base.Clone() as MonitorItem;
+ cloned.TechMonitor = TechMonitor;
+ return cloned;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs
index bfeeef011..820c765cc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Items/TechItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs
@@ -3,9 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+using System.Xml.Serialization;
using Tango.Core;
+using Tango.Integration.Observables;
-namespace Tango.MachineStudio.Technician.Items
+namespace Tango.MachineStudio.Technician.TechItems
{
public abstract class TechItem : ExtendedObject
{
@@ -13,8 +16,28 @@ namespace Tango.MachineStudio.Technician.Items
{
ID = Guid.NewGuid().ToString();
Name = "Untitled";
+ Adapter = ObservablesEntitiesAdapter.Instance;
}
+ private String _description;
+ [XmlIgnore]
+ public String Description
+ {
+ get { return _description; }
+ set { _description = value; RaisePropertyChangedAuto(); }
+ }
+
+ private BitmapSource _image;
+ [XmlIgnore]
+ public BitmapSource Image
+ {
+ get { return _image; }
+ set { _image = value; RaisePropertyChangedAuto(); }
+ }
+
+ [XmlIgnore]
+ public ObservablesEntitiesAdapter Adapter { get; set; }
+
private String _id;
/// <summary>
/// Unique Item ID.
@@ -29,6 +52,7 @@ namespace Tango.MachineStudio.Technician.Items
/// <summary>
/// item Name.
/// </summary>
+ [XmlIgnore]
public String Name
{
get { return _name; }
@@ -85,6 +109,9 @@ namespace Tango.MachineStudio.Technician.Items
set { _angle = value; RaisePropertyChanged(nameof(Angle)); }
}
+ [XmlIgnore]
+ public abstract object Data { get; }
+
public virtual TechItem Clone()
{
TechItem cloned = Activator.CreateInstance(this.GetType()) as TechItem;
@@ -95,5 +122,17 @@ namespace Tango.MachineStudio.Technician.Items
cloned.Angle = Angle;
return cloned;
}
+
+ public static List<TechItem> GetAvailableTechItems()
+ {
+ List<TechItem> items = new List<TechItem>();
+
+ foreach (var type in typeof(TechItem).Assembly.GetTypes().Where(x => typeof(TechItem).IsAssignableFrom(x) && !x.IsAbstract))
+ {
+ items.Add(Activator.CreateInstance(type) as TechItem);
+ }
+
+ return items;
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
index 6bdc4c7df..c75bcdf29 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs
@@ -43,7 +43,7 @@ namespace Tango.MachineStudio.Technician
/// <summary>
/// Gets the module entry point view.
/// </summary>
- public FrameworkElement MainView => new MainView();
+ public FrameworkElement MainView => new MachineTechView();
/// <summary>
/// Gets the permission required to see and load this module.
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 51c2b840d..4420aa4c9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -1,42 +1,179 @@
-using System;
+using Google.Protobuf.Collections;
+using RealTimeGraphEx.Controllers;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.Editors;
using Tango.Integration.Observables;
+using Tango.Integration.Operators;
+using Tango.MachineStudio.Common.StudioApplication;
using Tango.MachineStudio.Technician.Editors;
-using Tango.MachineStudio.Technician.Items;
+using Tango.MachineStudio.Technician.TechItems;
+using Tango.PMR.Diagnostics;
using Tango.SharedUI;
namespace Tango.MachineStudio.Technician.ViewModels
{
public class MachineTechViewVM : ViewModel
{
- private ObservableCollection<IElementEditor> _elements;
+ private List<PropertyInfo> _diagnoticsDataProperties;
+ private Dictionary<SingleGraphItem, GraphController> _singleControllers;
+ private static object _elementsLock = new object();
+ private ObservableCollection<IElementEditor> _elements;
public ObservableCollection<IElementEditor> Elements
{
get { return _elements; }
set { _elements = value; RaisePropertyChangedAuto(); }
}
+ private ObservableCollection<TechItem> _availableTechItems;
+ public ObservableCollection<TechItem> AvailableTechItems
+ {
+ get { return _availableTechItems; }
+ set { _availableTechItems = value; RaisePropertyChangedAuto(); }
+ }
+
+ private TechItem _selectedTechItem;
+
+ public TechItem SelectedTechItem
+ {
+ get { return _selectedTechItem; }
+ set { _selectedTechItem = value; RaisePropertyChangedAuto(); }
+ }
+
public ObservablesEntitiesAdapter Adapter { get; set; }
- public MachineTechViewVM()
+ public IStudioApplicationManager ApplicationManager { get; set; }
+
+ private IMachineOperator _machineOperator;
+
+ public IMachineOperator MachineOperator
{
+ get { return _machineOperator; }
+ set { _machineOperator = value; RaisePropertyChangedAuto(); }
+ }
+
+ public MachineTechViewVM(IStudioApplicationManager applicationManager)
+ {
+ _singleControllers = new Dictionary<SingleGraphItem, GraphController>();
+ AvailableTechItems = TechItem.GetAvailableTechItems().ToObservableCollection();
+ SelectedTechItem = AvailableTechItems.FirstOrDefault();
+ _diagnoticsDataProperties = typeof(PushDiagnosticsResponse).GetProperties(BindingFlags.Public | BindingFlags.Instance).ToList();
+ ApplicationManager = applicationManager;
+ ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
+
Adapter = ObservablesEntitiesAdapter.Instance;
- Adapter.Initialize(); //TODO: Remove on Machine Studio.
+ //Adapter.Initialize(); //TODO: Remove on Machine Studio.
Elements = new ObservableCollection<IElementEditor>();
}
+ private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine)
+ {
+ MachineOperator = machine;
+
+ if (MachineOperator != null)
+ {
+ MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable;
+ MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable;
+ }
+ }
+
+ private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response)
+ {
+ PopulateDiagnosticsData(response);
+ }
+
+ private void PopulateDiagnosticsData(PushDiagnosticsResponse data)
+ {
+ lock (_elementsLock)
+ {
+ var elements = Elements.ToList();
+
+ foreach (var item in elements.Select(x => x.HostedElement as TechItem))
+ {
+ if (item.GetType() == typeof(MonitorItem))
+ {
+ MonitorItem monitorItem = item as MonitorItem;
+
+ var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == monitorItem.TechMonitor.Name);
+
+ if (prop != null)
+ {
+ monitorItem.Value = GetLastMonitorValue(monitorItem.TechMonitor, prop.GetValue(data));
+ }
+ }
+ else if (item.GetType() == typeof(SingleGraphItem))
+ {
+ SingleGraphItem graphItem = item as SingleGraphItem;
+
+ var prop = _diagnoticsDataProperties.SingleOrDefault(x => x.Name == graphItem.TechMonitor.Name);
+
+ if (prop != null)
+ {
+ GraphController controller = null;
+
+ if (_singleControllers.TryGetValue(graphItem, out controller))
+ {
+ controller.PushData(GetSingleGraphValues(graphItem.TechMonitor, prop.GetValue(data)));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private double GetLastMonitorValue(TechMonitor monitor, object value)
+ {
+ if (!monitor.MultiChannel)
+ {
+ RepeatedField<double> arr = value as RepeatedField<double>;
+ return arr.LastOrDefault();
+ }
+ else
+ {
+ RepeatedField<DoubleArray> arr = value as RepeatedField<DoubleArray>;
+ return arr.Last().Data.Last();
+ }
+ }
+
+ private List<double> GetSingleGraphValues(TechMonitor monitor, object value)
+ {
+ return (value as RepeatedField<double>).ToList();
+ }
+
public void AddElement(Rect bounds)
{
- MonitorItem item = new MonitorItem(Adapter.TechMonitors.FirstOrDefault());
- MonitorElementEditor editor = new MonitorElementEditor(item, bounds);
- Elements.Add(editor);
+ lock (_elementsLock)
+ {
+ if (SelectedTechItem is MonitorItem)
+ {
+ var monitorItem = new MonitorItem(Adapter.TechMonitors.FirstOrDefault());
+ MonitorElementEditor editor = new MonitorElementEditor(monitorItem, bounds);
+ Elements.Add(editor);
+ }
+ else if (SelectedTechItem is SingleGraphItem)
+ {
+ var graphItem = new SingleGraphItem(Adapter.TechMonitors.FirstOrDefault());
+ SingleGraphElementEditor editor = new SingleGraphElementEditor(graphItem, bounds);
+ editor.InnerGraph.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(graphItem.TechMonitor.PointsPerFrame);
+ editor.DataContext = graphItem;
+ graphItem.Editor = editor;
+
+
+ GraphController controller = new GraphController();
+ editor.InnerGraph.Controller = controller;
+
+ _singleControllers.Add(graphItem, controller);
+
+ Elements.Add(editor);
+ }
+ }
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
index 256a4a385..371caf5d7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml
@@ -5,8 +5,11 @@
xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels"
xmlns:global="clr-namespace:Tango.MachineStudio.Technician"
xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors"
+ xmlns:techItems="clr-namespace:Tango.MachineStudio.Technician.TechItems"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:templates="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates"
+ xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views"
@@ -37,7 +40,34 @@
</Menu>
<Grid Grid.Row="1">
-
+ <StackPanel Orientation="Horizontal" Margin="20 0 0 0">
+ <ListBox ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding AvailableTechItems}" SelectedItem="{Binding SelectedTechItem,Mode=TwoWay}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation="Horizontal"></StackPanel>
+ </ItemsPanelTemplate>
+ </ListBox.ItemsPanel>
+ <ListBox.ItemTemplate>
+ <DataTemplate DataType="{x:Type techItems:TechItem}">
+ <Border Cursor="Hand" ToolTip="{Binding Description}" Width="70" Padding="10" Margin="5" Height="70" BorderThickness="1" CornerRadius="100">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True">
+ <Setter Property="Background" Value="#F9F9F9"></Setter>
+ <Setter Property="BorderBrush" Value="#FF7575"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Image Source="{Binding Image}" RenderOptions.BitmapScalingMode="Fant"></Image>
+ </Border>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </StackPanel>
</Grid>
</Grid>
@@ -49,12 +79,15 @@
<Grid>
<editors:ElementsEditor
+ x:Name="editor"
Elements="{Binding Elements}"
ElementCreation="ElementsEditor_ElementCreation"
Margin="0 0 5 0"
RulerHeight="32"
+ EditorWidth="1920"
+ EditorHeight="1080"
FontSize="10"
- Background="White"
+ Background="#F1F1F1"
EditorBackground="White"
RulerBackground="White"
Foreground="{StaticResource AccentColorBrush}"
@@ -65,9 +98,60 @@
</Grid>
<Grid Grid.Column="1">
- <GroupBox Header="PROPERTIES">
-
- </GroupBox>
+ <StackPanel>
+ <TextBlock Margin="0 -30 0 0" DataContext="{Binding ElementName=editor,Path=SelectedElement.HostedElement.Data}" Text="{Binding Description}" FontSize="16" FontWeight="Bold" FontStyle="Italic"></TextBlock>
+ <GroupBox Header="BOUNDS" Padding="5">
+ <StackPanel>
+ <!--Position-->
+ <UniformGrid Columns="2" Margin="0 5 0 0">
+ <StackPanel Margin="0 0 5 0">
+ <TextBlock>Left</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding ElementName=editor,Path=EditorWidth}" Value="{Binding ElementName=editor,Path=SelectedElement.Left}"></mahapps:NumericUpDown>
+ </StackPanel>
+ <StackPanel Margin="5 0 0 0">
+ <TextBlock>Top</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="0" Maximum="{Binding ElementName=editor,Path=EditorHeight}" Value="{Binding ElementName=editor,Path=SelectedElement.Top}"></mahapps:NumericUpDown>
+ </StackPanel>
+ </UniformGrid>
+
+ <!--Size-->
+ <UniformGrid Columns="2" Margin="0 20 0 0">
+ <StackPanel Margin="0 0 5 0">
+ <TextBlock>Width</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding ElementName=editor,Path=EditorWidth}" Value="{Binding ElementName=editor,Path=SelectedElement.Width}"></mahapps:NumericUpDown>
+ </StackPanel>
+ <StackPanel Margin="5 0 0 0">
+ <TextBlock>Height</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="False" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="10" Maximum="{Binding ElementName=editor,Path=EditorHeight}" Value="{Binding ElementName=editor,Path=SelectedElement.Height}"></mahapps:NumericUpDown>
+ </StackPanel>
+ </UniformGrid>
+
+ <!--<Angle-->
+ <Grid Margin="0 20 0 0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="22*"></ColumnDefinition>
+ <ColumnDefinition Width="20*"></ColumnDefinition>
+ </Grid.ColumnDefinitions>
+ <TextBlock VerticalAlignment="Center" Margin="0 0 10 0" HorizontalAlignment="Left">Angle</TextBlock>
+ <mahapps:NumericUpDown Grid.Column="1" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Maximum="360" Minimum="-360" HasDecimals="False" Margin="0 5 0 0" Value="{Binding ElementName=editor,Path=SelectedElement.Angle}"></mahapps:NumericUpDown>
+ </Grid>
+ </StackPanel>
+ </GroupBox>
+
+
+ <GroupBox Header="PROPERTIES" Margin="0 10 0 0">
+ <ContentControl DataContext="{Binding ElementName=editor,Path=SelectedElement.HostedElement}" Content="{Binding ElementName=editor,Path=SelectedElement.HostedElement}">
+ <ContentControl.Resources>
+ <DataTemplate DataType="{x:Type items:MonitorItem}">
+ <templates:MonitorTemplate/>
+ </DataTemplate>
+ <DataTemplate DataType="{x:Type items:SingleGraphItem}">
+ <templates:SingleGraphTemplate/>
+ </DataTemplate>
+ </ContentControl.Resources>
+ </ContentControl>
+ </GroupBox>
+ </StackPanel>
</Grid>
</Grid>
</Grid>