diff options
5 files changed, 78 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore index db77895f3..4ea289c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -298,3 +298,4 @@ __pycache__/ /.metadata /RemoteSystemsTempFiles /Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer-cache +/Software/Visual_Studio/Build diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml index 5c7d361ef..d550cbccb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 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" @@ -76,14 +77,61 @@ <Border Background="#202020" Margin="0 3 0 0" CornerRadius="3" Padding="5" Grid.Column="1"> <Grid> - <mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="400" Padding="0" Value="{Binding SetPoint,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 12 0"> + <mahapps:NumericUpDown x:Name="txtSetPoint" InterceptMouseWheel="True" IsHitTestVisible="{Binding IsEditing}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="400" Padding="0" Value="{Binding SetPoint,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="digital-7" Foreground="#FFD400" Margin="0 0 12 0"> <mahapps:NumericUpDown.Resources> <Style TargetType="TextBox"> - + <Setter Property="Opacity" Value="1"></Setter> + <Setter Property="CaretBrush" Value="#FFD400"></Setter> + <Setter Property="SelectionBrush" Value="#50FFD400"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsEditing}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard Name="blink"> + <Storyboard> + <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="Opacity" FillBehavior="Stop"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="1" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:1" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="blink" /> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> </Style> </mahapps:NumericUpDown.Resources> + + <mahapps:NumericUpDown.Style> + <Style TargetType="mahapps:NumericUpDown"> + + </Style> + </mahapps:NumericUpDown.Style> </mahapps:NumericUpDown> <TextBlock ToolTip="Setting Value" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="9" Foreground="Gainsboro">SV</TextBlock> + + <ToggleButton Checked="ToggleButton_Checked" Style="{x:Null}" IsChecked="{Binding IsEditing}" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0.2" Cursor="Hand"> + <ToggleButton.Template> + <ControlTemplate TargetType="ToggleButton"> + <Grid Background="Transparent"> + <materialDesign:PackIcon Width="24" Height="24" Foreground="#FFD400"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="PencilBox"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsEditing}" Value="True"> + <Setter Property="Kind" Value="Pencil"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> </Grid> </Border> </Grid> @@ -149,7 +197,7 @@ <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Gray" FontSize="16" FontWeight="SemiBold">TWI</TextBlock> <Grid Grid.Column="1"> - <Button Style="{x:Null}" Width="60" Height="60" HorizontalAlignment="Right" Cursor="Hand" Command="{Binding SetCommand}"> + <Button Style="{x:Null}" Width="60" Height="60" HorizontalAlignment="Right" Cursor="Hand" Command="{Binding SetCommand}" IsEnabled="{Binding IsEditing}"> <Button.Template> <ControlTemplate TargetType="Button"> <Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs index 37d0defe5..ae105f768 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml.cs @@ -106,5 +106,11 @@ namespace Tango.MachineStudio.Technician.Editors { } + + private void ToggleButton_Checked(object sender, RoutedEventArgs e) + { + txtSetPoint.Focus(); + txtSetPoint.SelectAll(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs index e91c3f185..d419127c5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/HeaterItem.cs @@ -47,7 +47,11 @@ namespace Tango.MachineStudio.Technician.TechItems Color = Colors.White; Description = "Heater Controller"; Image = ResourceHelper.GetImageFromResources("Images/heater-controller.png"); - SetCommand = new RelayCommand(() => { SetCommandClicked?.Invoke(); }, (x) => HeaterState.CurrentValue != SetPoint); + SetCommand = new RelayCommand(() => + { + SetCommandClicked?.Invoke(); + IsEditing = false; + }, (x) => HeaterState.CurrentValue != SetPoint); HeaterState = new HeaterState(); } @@ -72,6 +76,11 @@ namespace Tango.MachineStudio.Technician.TechItems _heaterState = value; RaisePropertyChangedAuto(); + if (!IsEditing) + { + SetPoint = _heaterState.SetPoint; + } + InvokeUI(() => { SetCommand.RaiseCanExecuteChanged(); @@ -89,6 +98,15 @@ namespace Tango.MachineStudio.Technician.TechItems set { _setPoint = value; RaisePropertyChangedAuto(); } } + private bool _isEditing; + [XmlIgnore] + public bool IsEditing + { + get { return _isEditing; } + set { _isEditing = value; RaisePropertyChangedAuto(); } + } + + /// <summary> /// Clones this instance. /// </summary> diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 4604d6903..7954b2324 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -826,6 +826,7 @@ namespace Tango.Emulations.Emulators heater.IsRampingUp = true; heater.IsActive = true; heater.IsInSetPoint = false; + heater.SetPoint = targetValue; if (targetValue > startValue) { |
