diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-10 17:27:37 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-10 17:27:37 +0200 |
| commit | f8e1ff79cc2fa09b52093c6e029392b3456ad8bb (patch) | |
| tree | fc72fecd6564b49a4b7787c0b4161bcb45edc758 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician | |
| parent | 07e686eb253ffd29f36dbe530b3a17633e02b353 (diff) | |
| download | Tango-f8e1ff79cc2fa09b52093c6e029392b3456ad8bb.tar.gz Tango-f8e1ff79cc2fa09b52093c6e029392b3456ad8bb.zip | |
Added dispensers support on technician module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician')
21 files changed, 985 insertions, 43 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml new file mode 100644 index 000000000..b84da3b42 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml @@ -0,0 +1,288 @@ +<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.DispenserElementEditor" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" + xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" + mc:Ignorable="d" + d:DesignHeight="164.393" d:DesignWidth="224.65" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="1" MinHeight="1" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:DispenserItem, IsDesignTimeCreatable=False}"> + + <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> + + <Grid x:Key="gridHoming"> + <DockPanel> + <Button Click="OnHomingStopped" DockPanel.Dock="Right" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" VerticalAlignment="Center" Margin="0 0 5 0" ToolTip="Stop Homing"> + <materialDesign:PackIcon Kind="Stop" Foreground="#FF5F5F" HorizontalAlignment="Center" VerticalAlignment="Center" Width="32" Height="32" /> + </Button> + <ProgressBar Foreground="DimGray" BorderBrush="DimGray" Maximum="{Binding HomingMaximumProgress}" Value="{Binding HomingProgress}" VerticalAlignment="Center" Height="10" Margin="5 0 5 0" Background="Transparent"></ProgressBar> + </DockPanel> + </Grid> + + <Grid x:Key="gridDefault"> + <Viewbox Stretch="Fill"> + <materialDesign:PackIcon Kind="Home" Margin="25 0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + </Viewbox> + + <Button Click="OnHomingStarted" Style="{StaticResource emptyButton}" Cursor="Hand" Background="Transparent" BorderThickness="0"></Button> + </Grid> + </UserControl.Resources> + + <UserControl.RenderTransform> + <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform> + </UserControl.RenderTransform> + + <Grid> + + <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="100*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> + + <Grid.RowDefinitions> + <RowDefinition Height="100*" /> + <RowDefinition Height="30*" /> + </Grid.RowDefinitions> + + <Grid Grid.Column="1"> + <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> + <Border.Background> + <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> + </Border.Background> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="63*"/> + <ColumnDefinition Width="88*"/> + </Grid.ColumnDefinitions> + <Image Source="../Images/dispenser-line.png" Grid.ColumnSpan="2" Stretch="Fill"></Image> + + <Path RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" StrokeThickness="1" Stroke="Gray" Stretch="Uniform" Data="M728.4 312.2l-198.1-63.4c-0.5-5.9-1.6-11.6-3.4-17c8.4-2.8 17-5.9 25.7-9.2c78.8-29.7 124.3-63 135-98.8 c7.2-23.8-0.5-47.5-22.6-70.3c-17.5-18-56.2-44.9-57.8-46c-6.2-4.3-14.7-2.8-19.1 3.3L465.5 180.8c-3.2-0.4-6.4-0.6-9.6-0.6 c-2.2 0-4.5 0.1-6.7 0.3c-0.5-62.6-8.3-142.4-41.1-178.6c-12.7-14.1-28.3-21.2-46.1-21.2c0 0 0 0 0 0c-12.3 0-25.6 3.5-39.7 10.4 c-17.4 8.6-43.8 27.5-55.6 36.2c-3.5 2.6-5.7 4.2-6.1 4.5c-3.7 2.8-5.6 7.2-5.4 11.6c0.1 2.6 1 5.3 2.7 7.5l128.9 175.8 c-1.4 3.5-2.6 7.1-3.4 10.8c-42.1-13.7-94.9-27.4-138.4-27.4c-34.2 0-59.1 8.6-73.8 25.7c-13 15-17.7 35.8-14 61.7 c3.6 24.8 19.1 69.3 19.7 71.2c2 5.7 7.3 9.3 13 9.3c1.4 0 2.9-0.2 4.3-0.7L404 308.3c2.3 2.3 4.8 4.4 7.4 6.3 c-7.3 10-14.8 20.7-22.3 32c-46.3 70.4-63.5 124-51.1 159.3c8.2 23.5 28.3 38.2 59.6 43.6c16.2 2.8 41.8 3.4 60.4 3.4 c8.1 0 13.5-0.1 13.5-0.1c7.5-0.2 13.5-6.3 13.5-13.9L484 323.8c4.1-1.7 8.1-3.7 11.8-6.1c6.1 8.3 12.6 16.9 19.5 25.6 c52.2 65.4 97.5 98.6 134.8 98.6c17.6 0 42.4-7.5 61.3-43.3c11.7-22.2 25.4-67.3 25.9-69.2C739.5 322.2 735.5 314.5 728.4 312.2z M455.9 293c-21.1 0-38.3-17.1-38.3-38.3s17.1-38.3 38.3-38.3c21.1 0 38.3 17.1 38.3 38.3C494.2 275.9 477 293 455.9 293z"> + <Path.Fill> + <LinearGradientBrush> + <GradientStop Color="Black"/> + <GradientStop Color="{Binding Color}" Offset="0.8"/> + </LinearGradientBrush> + </Path.Fill> + <Path.RenderTransform> + <RotateTransform x:Name="propRotate" Angle="0" /> + </Path.RenderTransform> + </Path> + <!--<Image RenderTransformOrigin="0.5,0.5" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Source="../Images/prop.png" RenderOptions.BitmapScalingMode="Fant"> + <Image.RenderTransform> + <RotateTransform x:Name="propRotate" Angle="0" /> + </Image.RenderTransform> + </Image>--> + </Grid> + </Border> + </Grid> + + <Grid> + <Border BorderBrush="Gray" Cursor="Hand" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#AAAAAA" Offset="1" /> + <GradientStop Color="#FFEEEEEE" Offset="0"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFCECECE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFEEEEEE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + </Viewbox> + </Border> + </Grid> + + <Grid Grid.Column="2"> + <Border BorderBrush="Gray" Cursor="Hand" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="1,0"> + <GradientStop Color="#AAAAAA" Offset="0" /> + <GradientStop Color="#FFEEEEEE" Offset="1"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFCECECE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFEEEEEE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Viewbox Stretch="Fill" Margin="-10 20"> + <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> + </Viewbox> + </Border> + </Grid> + + <Grid Grid.Column="1" Grid.Row="1"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="20*"/> + <ColumnDefinition Width="115*"/> + <ColumnDefinition Width="20*"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1"> + <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Background"> + <Setter.Value> + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#979797" Offset="1" /> + <GradientStop Color="#FFEEEEEE" Offset="0"/> + </LinearGradientBrush> + </Setter.Value> + </Setter> + <Style.Triggers> + <EventTrigger RoutedEvent="PreviewMouseDown"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFCECECE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + <EventTrigger RoutedEvent="PreviewMouseUp"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Background.GradientStops[1].Color" To="#FFEEEEEE" Duration="00:00:0.1" /> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <Grid> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content" Value="{StaticResource gridDefault}"> + + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHoming}" Value="True"> + <Setter Property="Content" Value="{StaticResource gridHoming}"> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + + </ContentControl> + </Grid> + </Border> + </Grid> + </Grid> + + + </Grid> + + <!--Content--> + <Grid> + <Border Margin="0 0 0 -23" VerticalAlignment="Bottom"> + <TextBlock Text="{Binding TechDispenser.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/DispenserElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs new file mode 100644 index 000000000..ef6e4c47c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml.cs @@ -0,0 +1,181 @@ +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.Animation; +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 DispenserElementEditor : ElementEditor + { + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + public DispenserElementEditor() + : base() + { + InitializeComponent(); + } + + /// <summary> + /// Initializes a new instance of the <see cref="MonitorElementEditor"/> class. + /// </summary> + /// <param name="frameworkElement">The framework element.</param> + public DispenserElementEditor(DispenserItem dispenserItem) + : this() + { + DispenserItem = dispenserItem; + DataContext = DispenserItem; + } + + /// <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 DispenserElementEditor(DispenserItem monitorItem, Rect bounds) + : this(monitorItem) + { + Left = bounds.Left; + Top = bounds.Top; + Width = bounds.Width; + Height = bounds.Height; + } + + private DispenserItem _monitorItem; + + public DispenserItem DispenserItem + { + get { return _monitorItem; } + set + { + _monitorItem = value; RaisePropertyChanged(nameof(DispenserItem)); + + if (_monitorItem != null) + { + _monitorItem.HomingCompleted -= _monitorItem_HomingCompleted; + _monitorItem.HomingCompleted += _monitorItem_HomingCompleted; + } + } + } + + private void _monitorItem_HomingCompleted(object sender, EventArgs e) + { + StopAnimation(); + } + + + /// <summary> + /// Clones this instance. + /// </summary> + /// <returns></returns> + public override IElementEditor Clone() + { + try + { + var clonedItem = DispenserItem.Clone() as DispenserItem; + DispenserElementEditor cloned = new DispenserElementEditor(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 DispenserItem; } + } + + private void OnForwardPressed(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.ForwardPressed); + AnimateRight(); + } + + private void OnForwardReleased(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.ForwardReleased); + StopAnimation(); + } + + private void OnBackwardPressed(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.BackwardPressed); + AnimateLeft(); + } + + private void OnBackwardReleased(object sender, MouseButtonEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.BackwardReleased); + StopAnimation(); + } + + private void OnHomingStarted(object sender, RoutedEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.HomingStarted); + AnimateLeft(); + } + + private void OnHomingStopped(object sender, RoutedEventArgs e) + { + DispenserItem.RaiseAction(MotorActionType.HomingStopped); + StopAnimation(); + } + + private void AnimateRight() + { + DoubleAnimation ani = new DoubleAnimation(); + ani.Duration = TimeSpan.FromSeconds(1); + ani.RepeatBehavior = RepeatBehavior.Forever; + ani.FillBehavior = FillBehavior.HoldEnd; + ani.To = 360; + propRotate.BeginAnimation(RotateTransform.AngleProperty, ani); + } + + private void AnimateLeft() + { + DoubleAnimation ani = new DoubleAnimation(); + ani.Duration = TimeSpan.FromSeconds(1); + ani.RepeatBehavior = RepeatBehavior.Forever; + ani.FillBehavior = FillBehavior.HoldEnd; + ani.To = -360; + propRotate.BeginAnimation(RotateTransform.AngleProperty, ani); + } + + public void StopAnimation() + { + this.Dispatcher.Invoke(() => + { + propRotate.BeginAnimation(RotateTransform.AngleProperty, null); + }); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml index 8a9345fa9..98ace7816 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml @@ -3,6 +3,7 @@ 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" @@ -12,6 +13,7 @@ <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <!--Theme--> <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> @@ -26,13 +28,13 @@ <!--Content--> - <Grid> + <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> <Grid.RowDefinitions> <RowDefinition Height="221*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> - <visuals:VUMeter Width="Auto" Height="Auto" LedBackground="Silver" TicksCount="{Binding TicksCount}" TicksPlacement="{Binding TickPlacement}" LedCount="{Binding LedCount}" Orientation="Vertical" Margin="0 0 0 10" ShowTicksLabels="True" ShowTicksLines="True" EmulateOuterLight="True" SunkenLeds="True" Value="{Binding Value}" TicksMinimum="{Binding TechMonitor.Min}" TicksMaximum="{Binding TechMonitor.Max}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}"> + <visuals:VUMeter Width="Auto" Height="Auto" LedBackground="#383838" TicksCount="{Binding TicksCount}" TicksPlacement="{Binding TickPlacement}" LedCount="{Binding LedCount}" Orientation="Vertical" Margin="0 0 0 10" ShowTicksLabels="True" ShowTicksLines="True" EmulateOuterLight="True" SunkenLeds="True" Value="{Binding Value}" TicksMinimum="{Binding TechMonitor.Min}" TicksMaximum="{Binding TechMonitor.Max}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}"> <visuals:VUMeter.Foreground> <SolidColorBrush Color="{Binding Color}" /> </visuals:VUMeter.Foreground> 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 8e4520cc5..081a853bb 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 @@ -5,12 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" d:DesignHeight="250" d:DesignWidth="300" 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> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <!--Theme--> <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> @@ -25,7 +27,7 @@ <!--Content--> - <Grid> + <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> <Viewbox Stretch="Fill"> <StackPanel> <Grid Grid.Column="1" Grid.Row="1" Width="200" Height="120"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml index bf7aaeff4..a69f81538 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" 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" @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <!--Theme--> <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> @@ -20,10 +22,12 @@ <Grid x:Key="gridHoming"> <DockPanel> - <Button Click="OnHomingStopped" DockPanel.Dock="Right" Padding="0" Style="{StaticResource emptyButton}" VerticalAlignment="Center" Margin="0 0 5 0"> - <materialDesign:PackIcon Kind="Stop" Foreground="#FF5F5F" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" /> + <Button Click="OnHomingStopped" DockPanel.Dock="Right" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" VerticalAlignment="Center" Margin="0 0 5 0" ToolTip="Stop Homing"> + <materialDesign:PackIcon Kind="Stop" Foreground="#FF5F5F" HorizontalAlignment="Center" VerticalAlignment="Center" Width="32" Height="32" /> </Button> - <ProgressBar Maximum="{Binding HomingMaximumProgress}" Value="{Binding HomingProgress}" VerticalAlignment="Center" Height="10" Margin="5 0 5 0" Background="Transparent"></ProgressBar> + <ProgressBar Foreground="DimGray" BorderBrush="DimGray" Maximum="{Binding HomingMaximumProgress}" BorderThickness="1" Value="{Binding HomingProgress}" VerticalAlignment="Center" Height="10" Margin="5 0 5 0" Background="Transparent"> + + </ProgressBar> </DockPanel> </Grid> @@ -42,7 +46,7 @@ <Grid> - <Grid Margin="5"> + <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="20*"/> <ColumnDefinition Width="100*"/> @@ -55,27 +59,35 @@ </Grid.RowDefinitions> <Grid Grid.Column="1"> - <Border BorderThickness="1" BorderBrush="Gainsboro" CornerRadius="5"> + <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="5"> <Border.Background> <ImageBrush ImageSource="../Images/black-screen.jpg" Opacity="0.1" /> </Border.Background> - <Image RenderTransformOrigin="0.5,0.5" Margin="5" Source="../Images/prop.png" RenderOptions.BitmapScalingMode="Fant"> - <Image.RenderTransform> - <RotateTransform x:Name="propRotate" Angle="0" /> - </Image.RenderTransform> - </Image> + <Grid> + <Path RenderTransformOrigin="0.5,0.5" StrokeThickness="1" Stroke="Gray" Stretch="Uniform" Margin="5" Data="M500.633 211.454l-58.729-14.443c-3.53-11.133-8.071-21.929-13.55-32.256c8.818-14.678 27.349-45.571 27.349-45.571 c3.545-5.903 2.607-13.462-2.256-18.325l-42.422-42.422c-4.863-4.878-12.407-5.815-18.325-2.256L347.055 83.53 c-10.269-5.435-21.006-9.932-32.065-13.433l-14.443-58.729C298.876 4.688 292.885 0 286 0h-60 c-6.885 0-12.891 4.688-14.546 11.367c0 0-10.005 40.99-14.429 58.715c-11.792 3.735-23.188 8.584-34.043 14.502l-47.329-28.403 c-5.918-3.516-13.447-2.607-18.325 2.256l-42.422 42.422c-4.863 4.863-5.801 12.422-2.256 18.325l29.268 48.882 c-4.717 9.302-8.672 18.984-11.821 28.901l-58.729 14.487C4.688 213.124 0 219.115 0 226v60c0 6.885 4.688 12.891 11.367 14.546 l58.744 14.443c3.56 11.294 8.188 22.266 13.799 32.798l-26.191 43.652c-3.545 5.903-2.607 13.462 2.256 18.325l42.422 42.422 c4.849 4.849 12.407 5.771 18.325 2.256c0 0 29.37-17.607 43.755-26.221c10.415 5.552 21.313 10.137 32.549 13.696l14.429 58.715 C213.109 507.313 219.115 512 226 512h60c6.885 0 12.876-4.688 14.546-11.367l14.429-58.715 c11.558-3.662 22.69-8.394 33.281-14.136c14.78 8.862 44.443 26.66 44.443 26.66c5.903 3.53 13.462 2.622 18.325-2.256 l42.422-42.422c4.863-4.863 5.801-12.422 2.256-18.325l-26.968-44.927c5.317-10.093 9.727-20.654 13.169-31.523l58.729-14.443 C507.313 298.876 512 292.885 512 286v-60C512 219.115 507.313 213.124 500.633 211.454z M256 361c-57.891 0-105-47.109-105-105 s47.109-105 105-105s105 47.109 105 105S313.891 361 256 361z"> + <Path.Fill> + <LinearGradientBrush> + <GradientStop Color="Black"/> + <GradientStop Color="{Binding Color}" Offset="0.8"/> + </LinearGradientBrush> + </Path.Fill> + <Path.RenderTransform> + <RotateTransform x:Name="propRotate" Angle="0" /> + </Path.RenderTransform> + </Path> + </Grid> </Border> </Grid> <Grid> - <Border BorderBrush="Gainsboro" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased"> + <Border BorderBrush="Gray" BorderThickness="1 1 0 1" Margin="0 10" CornerRadius="5 0 0 5" PreviewMouseDown="OnBackwardPressed" PreviewMouseUp="OnBackwardReleased"> <Border.Style> <Style TargetType="Border"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush EndPoint="1,0"> - <GradientStop Color="#515151" Offset="1" /> + <GradientStop Color="#AAAAAA" Offset="1" /> <GradientStop Color="#FFEEEEEE" Offset="0"/> </LinearGradientBrush> </Setter.Value> @@ -103,20 +115,20 @@ </Style> </Border.Style> - <Viewbox Stretch="Fill" Margin="-10 10"> + <Viewbox Stretch="Fill" Margin="-10 20"> <materialDesign:PackIcon Kind="ChevronLeft" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> </Viewbox> </Border> </Grid> <Grid Grid.Column="2"> - <Border BorderBrush="Gainsboro" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased"> + <Border BorderBrush="Gray" BorderThickness="0 1 1 1" Margin="0 10" CornerRadius="0 10 10 0" PreviewMouseDown="OnForwardPressed" PreviewMouseUp="OnForwardReleased"> <Border.Style> <Style TargetType="Border"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush EndPoint="1,0"> - <GradientStop Color="#515151" Offset="0" /> + <GradientStop Color="#AAAAAA" Offset="0" /> <GradientStop Color="#FFEEEEEE" Offset="1"/> </LinearGradientBrush> </Setter.Value> @@ -144,7 +156,7 @@ </Style> </Border.Style> - <Viewbox Stretch="Fill" Margin="-10 10"> + <Viewbox Stretch="Fill" Margin="-10 20"> <materialDesign:PackIcon Kind="ChevronRight" HorizontalAlignment="Center" VerticalAlignment="Center" Width="24" Height="24" Foreground="#202020" /> </Viewbox> </Border> @@ -158,13 +170,13 @@ </Grid.ColumnDefinitions> <Grid Grid.Column="1"> - <Border BorderBrush="Gainsboro" BorderThickness="1 0 1 1" CornerRadius="0 0 10 10"> + <Border BorderBrush="Gray" BorderThickness="1 0 1 1" CornerRadius="0 0 20 20"> <Border.Style> <Style TargetType="Border"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> - <GradientStop Color="#515151" Offset="1" /> + <GradientStop Color="#979797" Offset="1" /> <GradientStop Color="#FFEEEEEE" Offset="0"/> </LinearGradientBrush> </Setter.Value> @@ -220,7 +232,7 @@ <!--Content--> <Grid> <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> + <TextBlock Text="{Binding TechMotor.Description}" FontSize="14" Foreground="DimGray" HorizontalAlignment="Center"></TextBlock> </Border> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml index fd2db03e5..51bb3ff9c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml @@ -5,6 +5,7 @@ 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:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" @@ -12,6 +13,7 @@ <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <!--Theme--> <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> @@ -28,7 +30,7 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphMultiControl x:Name="InnerGraph" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <controls:RealTimeGraphMultiControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" 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"> 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 index aa0ec24e8..a0dd0f697 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -5,6 +5,7 @@ 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:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors" mc:Ignorable="d" @@ -12,6 +13,7 @@ <UserControl.Resources> <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <!--Theme--> <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush> @@ -28,7 +30,7 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=TwoWay}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=TwoWay}" SensorUnits="{Binding TechMonitor.Units}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> <!--</Viewbox>--> <Border Margin="0 0 0 -23" VerticalAlignment="Bottom"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-big.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-big.png Binary files differnew file mode 100644 index 000000000..284b1da0e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-big.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-line.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-line.png Binary files differnew file mode 100644 index 000000000..9e2e344c0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/dispenser-line.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/volume.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/volume.png Binary files differnew file mode 100644 index 000000000..4f48f7528 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Images/volume.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml new file mode 100644 index 000000000..0eca72dcd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml @@ -0,0 +1,44 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.DispenserTemplate" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:DispenserItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" /> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <StackPanel> + <GroupBox Header="MOTOR"> + <StackPanel> + <TextBlock FontSize="10">Selected Motor</TextBlock> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechDispensers}" SelectedItem="{Binding TechDispenser,Mode=TwoWay}" DisplayMemberPath="Description" /> + + <TextBlock FontSize="10" Margin="0 20 0 0"><Run>Speed</Run> <Run Text="{Binding Speed,StringFormat={}{0:N0} ms,FallbackValue=0}"></Run></TextBlock> + <Slider Margin="0 5 0 0" Minimum="1" Maximum="1000" Value="{Binding Speed,Mode=TwoWay}"></Slider> + </StackPanel> + </GroupBox> + + <GroupBox Header="COLOR" Margin="0 10 0 0"> + <StackPanel> + <Viewbox Margin="0 5 0 0"> + <colorPicker:ColorCanvas SelectedColor="{Binding Color,Mode=TwoWay}" Background="Transparent" /> + </Viewbox> + </StackPanel> + </GroupBox> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.xaml.cs new file mode 100644 index 000000000..dd3a21b07 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/DispenserTemplate.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 DispenserTemplate : UserControl + { + public DispenserTemplate() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml new file mode 100644 index 000000000..0d92230ad --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml @@ -0,0 +1,44 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.PropertiesTemplates.MotorTemplate" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" + mc:Ignorable="d" + d:DesignHeight="500" d:DesignWidth="200" d:DataContext="{d:DesignInstance Type=items:MotorItem, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" /> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <StackPanel> + <GroupBox Header="MOTOR"> + <StackPanel> + <TextBlock FontSize="10">Selected Motor</TextBlock> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechMotors}" SelectedItem="{Binding TechMotor,Mode=TwoWay}" DisplayMemberPath="Description" /> + + <TextBlock FontSize="10" Margin="0 20 0 0"><Run>Speed</Run> <Run Text="{Binding Speed,StringFormat={}{0:N0} ms,FallbackValue=0}"></Run></TextBlock> + <Slider Margin="0 5 0 0" Minimum="1" Maximum="1000" Value="{Binding Speed,Mode=TwoWay}"></Slider> + </StackPanel> + </GroupBox> + + <GroupBox Header="COLOR" Margin="0 10 0 0"> + <StackPanel> + <Viewbox Margin="0 5 0 0"> + <colorPicker:ColorCanvas SelectedColor="{Binding Color,Mode=TwoWay}" Background="Transparent" /> + </Viewbox> + </StackPanel> + </GroupBox> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.xaml.cs new file mode 100644 index 000000000..3ac58ce5d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MotorTemplate.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 MotorTemplate : UserControl + { + public MotorTemplate() + { + 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 0f92b6275..34208aded 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 @@ -60,6 +60,22 @@ </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Interfaces, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Interfaces.3.1.1\lib\net45\System.Reactive.Interfaces.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Linq, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Linq.3.1.1\lib\net46\System.Reactive.Linq.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.PlatformServices, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.PlatformServices.3.1.1\lib\net46\System.Reactive.PlatformServices.dll</HintPath> + </Reference> + <Reference Include="System.Reactive.Windows.Threading, Version=3.0.1000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\System.Reactive.Windows.Threading.3.1.1\lib\net45\System.Reactive.Windows.Threading.dll</HintPath> + </Reference> + <Reference Include="System.Windows" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath> </Reference> @@ -81,6 +97,9 @@ <Compile Include="Converters\MonitorsToSingleChannleMonitorsConverter.cs" /> <Compile Include="Converters\SecondsToGraphPointsConverter.cs" /> <Compile Include="Converters\TransitionLinkConverter.cs" /> + <Compile Include="Editors\DispenserElementEditor.xaml.cs"> + <DependentUpon>DispenserElementEditor.xaml</DependentUpon> + </Compile> <Compile Include="Editors\MotorElementEditor.xaml.cs"> <DependentUpon>MotorElementEditor.xaml</DependentUpon> </Compile> @@ -100,6 +119,12 @@ <Compile Include="PropertiesTemplates\MeterTemplate.xaml.cs"> <DependentUpon>MeterTemplate.xaml</DependentUpon> </Compile> + <Compile Include="PropertiesTemplates\DispenserTemplate.xaml.cs"> + <DependentUpon>DispenserTemplate.xaml</DependentUpon> + </Compile> + <Compile Include="PropertiesTemplates\MotorTemplate.xaml.cs"> + <DependentUpon>MotorTemplate.xaml</DependentUpon> + </Compile> <Compile Include="PropertiesTemplates\MonitorTemplate.xaml.cs"> <DependentUpon>MonitorTemplate.xaml</DependentUpon> </Compile> @@ -111,6 +136,7 @@ </Compile> <Compile Include="TechItems\MeterItem.cs" /> <Compile Include="TechItems\MotorActionType.cs" /> + <Compile Include="TechItems\DispenserItem.cs" /> <Compile Include="TechItems\MotorItem.cs" /> <Compile Include="TechItems\MultiGraphItem.cs" /> <Compile Include="TechItems\SingleGraphItem.cs" /> @@ -141,6 +167,10 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Page Include="Editors\DispenserElementEditor.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Editors\MotorElementEditor.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -165,6 +195,14 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="PropertiesTemplates\DispenserTemplate.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="PropertiesTemplates\MotorTemplate.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="PropertiesTemplates\MonitorTemplate.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -311,5 +349,14 @@ <ItemGroup> <Resource Include="Images\engine.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\dispenser-line.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\dispenser-big.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\volume.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/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs new file mode 100644 index 000000000..3cea8d127 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -0,0 +1,127 @@ +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.Core.Commands; +using Tango.Integration.Observables; +using Tango.SharedUI.Helpers; + +namespace Tango.MachineStudio.Technician.TechItems +{ + public class DispenserItem : TechItem + { + public event EventHandler<MotorActionType> ActionExecuted; + public event EventHandler HomingCompleted; + + private TechDispenser _techDispenser; + [XmlIgnore] + public TechDispenser TechDispenser + { + get { return _techDispenser; } + set { _techDispenser = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(Data)); } + } + + private bool _isHoming; + [XmlIgnore] + public bool IsHoming + { + get { return _isHoming; } + set + { + _isHoming = value; + RaisePropertyChangedAuto(); + } + } + + private bool _isHomingCompleted; + + public bool IsHomingCompleted + { + get { return _isHomingCompleted; } + set + { + _isHomingCompleted = value; + RaisePropertyChangedAuto(); + + if (value) + { + HomingCompleted?.Invoke(this, new EventArgs()); + } + } + } + + private double _homingProgress; + [XmlIgnore] + public double HomingProgress + { + get { return _homingProgress; } + set + { + _homingProgress = value; + RaisePropertyChangedAuto(); + } + } + + private double _homingMaximumProgress; + [XmlIgnore] + public double HomingMaximumProgress + { + get { return _homingMaximumProgress; } + set { _homingMaximumProgress = value; RaisePropertyChangedAuto(); } + } + + private bool _isForwardPressed; + [XmlIgnore] + public bool IsForwardPressed + { + get { return _isForwardPressed; } + set { _isForwardPressed = value; RaisePropertyChangedAuto(); } + } + + private bool _isBackwardPressed; + [XmlIgnore] + public bool IsBackwardPressed + { + get { return _isBackwardPressed; } + set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } + } + + private double _speed; + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + + public override object Data => TechDispenser; + + public DispenserItem() : base() + { + Name = "Dispenser"; + Description = "Dispenser Controller"; + Image = ResourceHelper.GetImageFromResources("Images/dispenser-big.png"); + Color = Colors.White; + } + + public DispenserItem(TechDispenser techDispenser) : this() + { + TechDispenser = techDispenser; + } + + public override TechItem Clone() + { + DispenserItem cloned = base.Clone() as DispenserItem; + cloned.TechDispenser = TechDispenser; + return cloned; + } + + public void RaiseAction(MotorActionType action) + { + ActionExecuted?.Invoke(this, action); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs index 9d4fd9d60..7cc2913eb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MeterItem.cs @@ -67,7 +67,7 @@ namespace Tango.MachineStudio.Technician.TechItems { Name = "VU Monitor"; Description = "VU Meter monitor"; - Image = ResourceHelper.GetImageFromResources("Images/analog.png"); + Image = ResourceHelper.GetImageFromResources("Images/volume.png"); LastUpdateTime = DateTime.Now; UpdateInterval = 10; LedCount = 14; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index a7088ac3f..272aedf44 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Media; using System.Xml.Serialization; using Tango.Core.Commands; using Tango.Integration.Observables; @@ -88,6 +89,14 @@ namespace Tango.MachineStudio.Technician.TechItems set { _isBackwardPressed = value; RaisePropertyChangedAuto(); } } + private double _speed; + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + public override object Data => TechMotor; public MotorItem() : base() @@ -95,6 +104,7 @@ namespace Tango.MachineStudio.Technician.TechItems Name = "Motor"; Description = "Motor Controller"; Image = ResourceHelper.GetImageFromResources("Images/engine.png"); + Color = Colors.White; } public MotorItem(TechMotor techMotor) : this() 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 7bed3f441..8ed8a4a80 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 @@ -253,6 +253,13 @@ namespace Tango.MachineStudio.Technician.ViewModels Elements.Add(editor); InitMotorItem(motorItem); } + else if (SelectedTechItem is DispenserItem) + { + var dispenserItem = new DispenserItem(Adapter.TechDispensers.FirstOrDefault()); + DispenserElementEditor editor = new DispenserElementEditor(dispenserItem, bounds); + Elements.Add(editor); + InitDispenserItem(dispenserItem); + } } public void OnElementsRemoved(List<IElementEditor> elements) @@ -319,56 +326,139 @@ namespace Tango.MachineStudio.Technician.ViewModels { item.ActionExecuted += async (x, action) => { - if (action == MotorActionType.HomingStarted) + if (action == MotorActionType.ForwardPressed) + { + await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + { + Code = item.TechMotor.Code, + Direction = MotorDirection.Forward, + }); + } + else if (action == MotorActionType.ForwardReleased) + { + await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + { + Code = item.TechMotor.Code, + }); + } + else if (action == MotorActionType.BackwardPressed) + { + await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + { + Code = item.TechMotor.Code, + Direction = MotorDirection.Backward, + }); + } + else if (action == MotorActionType.BackwardReleased) + { + await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + { + Code = item.TechMotor.Code, + }); + } + else if (action == MotorActionType.HomingStarted) { item.HomingProgress = 0; item.IsHoming = true; item.IsHomingCompleted = false; - await Task.Factory.StartNew(() => + MachineOperator.StartMotorHoming(new MotorHomingRequest() + { + Code = item.TechMotor.Code + }) + .Subscribe((response) => { - for (int i = 0; i < 101; i++) - { - item.HomingMaximumProgress = 100; - item.HomingProgress++; - Thread.Sleep(60); - } + item.HomingMaximumProgress = response.Message.MaxProgress; + item.HomingProgress = response.Message.Progress; + + }, () => + { item.IsHoming = false; item.IsHomingCompleted = true; + }); } - else if (action == MotorActionType.ForwardPressed) + else if (action == MotorActionType.HomingStopped) { - await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + await MachineOperator.StopMotorHoming(new MotorAbortHomingRequest() { Code = item.TechMotor.Code, + }); + + item.IsHoming = false; + } + }; + } + + private void InitDispenserItem(DispenserItem item) + { + item.ActionExecuted += async (x, action) => + { + if (action == MotorActionType.ForwardPressed) + { + await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() + { + Code = item.TechDispenser.Code, Direction = MotorDirection.Forward, }); } else if (action == MotorActionType.ForwardReleased) { - await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, }); } else if (action == MotorActionType.BackwardPressed) { - await MachineOperator.StartMotorJogging(new MotorJoggingRequest() + await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, Direction = MotorDirection.Backward, }); } else if (action == MotorActionType.BackwardReleased) { - await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() + await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechMotor.Code, + Code = item.TechDispenser.Code, + }); + } + else if (action == MotorActionType.HomingStarted) + { + item.HomingProgress = 0; + item.IsHoming = true; + item.IsHomingCompleted = false; + + MachineOperator.StartDispenserHoming(new DispenserHomingRequest() + { + Code = item.TechDispenser.Code + }) + .Subscribe((response) => + { + + item.HomingMaximumProgress = response.Message.MaxProgress; + item.HomingProgress = response.Message.Progress; + + }, () => + { + + item.IsHoming = false; + item.IsHomingCompleted = true; + }); } + else if (action == MotorActionType.HomingStopped) + { + await MachineOperator.StopDispenserHoming(new DispenserAbortHomingRequest() + { + Code = item.TechDispenser.Code, + }); + + item.IsHoming = false; + } }; } } 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 7cdd92e06..9e3970719 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 @@ -50,15 +50,38 @@ </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 Cursor="Hand" ToolTip="{Binding Description}" RenderTransformOrigin="0.5,0.5" Width="70" Padding="10" Margin="5" Height="70" BorderThickness="1" CornerRadius="100"> <Border.Style> <Style TargetType="Border"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> + </Setter.Value> + </Setter> <Setter Property="Background" Value="Transparent"></Setter> <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> - <Setter Property="Background" Value="#F9F9F9"></Setter> + <Setter Property="Background" Value="White"></Setter> <Setter Property="BorderBrush" Value="#FF7575"></Setter> + <Setter Property="BorderThickness" Value="2"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> @@ -177,6 +200,12 @@ <DataTemplate DataType="{x:Type items:MonitorItem}"> <templates:MonitorTemplate/> </DataTemplate> + <DataTemplate DataType="{x:Type items:DispenserItem}"> + <templates:DispenserTemplate/> + </DataTemplate> + <DataTemplate DataType="{x:Type items:MotorItem}"> + <templates:MotorTemplate/> + </DataTemplate> <DataTemplate DataType="{x:Type items:MeterItem}"> <templates:MeterTemplate/> </DataTemplate> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index 1d449350a..61695a8c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -7,4 +7,10 @@ <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="System.Reactive" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Core" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Interfaces" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Linq" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.PlatformServices" version="3.1.1" targetFramework="net46" /> + <package id="System.Reactive.Windows.Threading" version="3.1.1" targetFramework="net46" /> </packages>
\ No newline at end of file |
