Files
HC_APTBS/Views/UserControls/BenchActuatorsCard.xaml
LucianoDev 69bfda54e1 feat: redesign Bench page with Fluent card layout and radial advance monitor
Three-column layout replacing the old HMI grid:
- BenchRpmCommandCard: inline numeric input, 2×4 preset grid, Start/Stop
- BenchActuatorsCard: direction toggle, oil pump, temperature PID, misc relays
  with FluentStateToggle showing checked state via AccentFillColor
- BenchLiveDataCard: 2×5 KPI tiles (RPM, P1, P2, Q-Delivery, Q-Over, temps)
- BenchChartsCard: 2×2 compact chart grid (Delivery, Over, P1, P2)
- AdvanceMonitorCard: RadialAngleGauge custom FrameworkElement + PSG/INJ readouts,
  Δ° lock offset input, Zero PSG / Zero INJ buttons

Supporting changes:
- AngleDisplayViewModel: promote _currentManualDegrees, _isLockSet to
  [ObservableProperty]; add PsgRelativeDegrees, InjEncoderDegreesValue,
  TargetLockAngle, IsRunningMode (29/31 hysteresis); computed PrimaryGaugeAngle,
  TargetAngleForGauge, SecondaryGaugeAngle
- BenchControlViewModel: add IsDirectionLeft computed property,
  SetDirectionRightCommand, SetDirectionLeftCommand, ApplyRpmCommand
- FlowmeterChartView: add IsCompact DP (false default) for 90px compact height
- Styles.xaml: add IsChecked trigger to FluentStateToggle (accent fill + white text)
- Strings.en/es.xaml: add all new card and actuator string keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 17:45:59 +02:00

220 lines
13 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.BenchActuatorsCard"
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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="560" d:DesignWidth="320">
<!--
Actuators & Relays card — sub-sections for direction, oil pump + counter,
temperature control, and misc relays.
DataContext = BenchPageViewModel (binds BenchControl.*, TempControl.*, RelayBank.*).
-->
<Border Style="{StaticResource PumpCard}">
<StackPanel>
<!-- ── Card header ─────────────────────────────────────────── -->
<DockPanel Margin="0,0,0,12">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="ToggleLeft24" FontSize="16"
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Bench.Actuators.Title}"
Style="{StaticResource PumpCardHeader}" Margin="0"/>
</DockPanel>
<!-- ── Direction ──────────────────────────────────────────── -->
<TextBlock Text="{DynamicResource Bench.Actuators.Direction}"
FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,6"/>
<Grid Margin="0,0,0,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Right — IsChecked=OneWay shows active state; Command performs the change -->
<ToggleButton Grid.Column="0" Height="40"
IsChecked="{Binding BenchControl.IsDirectionRight, Mode=OneWay}"
Command="{Binding BenchControl.SetDirectionRightCommand}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ui:SymbolIcon Symbol="ArrowRight24" FontSize="14" Margin="0,0,4,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.DirRight}" VerticalAlignment="Center"/>
</StackPanel>
</ToggleButton>
<!-- Left — IsDirectionLeft is the computed inverse of IsDirectionRight -->
<ToggleButton Grid.Column="2" Height="40"
IsChecked="{Binding BenchControl.IsDirectionLeft, Mode=OneWay}"
Command="{Binding BenchControl.SetDirectionLeftCommand}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ui:SymbolIcon Symbol="ArrowLeft24" FontSize="14" Margin="0,0,4,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.DirLeft}" VerticalAlignment="Center"/>
</StackPanel>
</ToggleButton>
</Grid>
<!-- ── Divider ─────────────────────────────────────────────── -->
<Border Height="1" Background="{DynamicResource ControlStrokeColorDefaultBrush}"
Margin="0,0,0,10"/>
<!-- ── Oil pump + Counter ──────────────────────────────────── -->
<TextBlock Text="{DynamicResource Bench.Actuators.OilPump}"
FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,6"/>
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="0" Height="40"
IsChecked="{Binding BenchControl.IsOilPumpOn}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Drop24" FontSize="14" Margin="0,0,4,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.OilPump}" VerticalAlignment="Center"/>
</StackPanel>
</ToggleButton>
<Border Grid.Column="2" Background="{DynamicResource ControlFillColorSecondaryBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1" CornerRadius="6" Padding="8,6">
<StackPanel>
<TextBlock Text="{DynamicResource Bench.Actuators.Counter}"
FontSize="10"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,2"/>
<TextBlock Text="{Binding BenchControl.BenchCounterValue, StringFormat=F0}"
FontFamily="Consolas" FontSize="18" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"/>
</StackPanel>
</Border>
</Grid>
<!-- Counter input row -->
<Grid Margin="0,0,0,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
Text="{Binding BenchControl.CounterInputText, UpdateSourceTrigger=PropertyChanged}"
FontFamily="Consolas" FontSize="16"
Height="36" VerticalContentAlignment="Center"
HorizontalContentAlignment="Right" Padding="8,0"/>
<ui:Button Grid.Column="2" Height="36"
Content="{DynamicResource Bench.Actuators.Set}"
Command="{Binding BenchControl.SendCounterCommand}"
Appearance="Secondary"/>
</Grid>
<!-- ── Divider ─────────────────────────────────────────────── -->
<Border Height="1" Background="{DynamicResource ControlStrokeColorDefaultBrush}"
Margin="0,0,0,10"/>
<!-- ── Temperature control ─────────────────────────────────── -->
<TextBlock Text="{DynamicResource Bench.Actuators.Temperature}"
FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,6"/>
<!-- Setpoint + tolerance input -->
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="6"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
Text="{Binding TempControl.SetpointText, UpdateSourceTrigger=PropertyChanged}"
ToolTip="{DynamicResource Bench.Actuators.Setpoint}"
FontFamily="Consolas" FontSize="16"
Height="36" VerticalContentAlignment="Center"
HorizontalContentAlignment="Right" Padding="8,0"/>
<TextBlock Grid.Column="0" Text="°C" FontSize="11"
VerticalAlignment="Center" HorizontalAlignment="Right"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,4,0" IsHitTestVisible="False"/>
<TextBox Grid.Column="2"
Text="{Binding TempControl.ToleranceText, UpdateSourceTrigger=PropertyChanged}"
ToolTip="{DynamicResource Bench.Actuators.Tolerance}"
FontFamily="Consolas" FontSize="16"
Height="36" VerticalContentAlignment="Center"
HorizontalContentAlignment="Right" Padding="8,0"/>
<ui:Button Grid.Column="4" Height="36"
Content="{DynamicResource Bench.RpmCommand.Apply}"
Command="{Binding TempControl.ApplySetpointCommand}"
Appearance="Secondary"/>
</Grid>
<!-- Heater / Deposit Cooler / T-in Cooler toggles -->
<UniformGrid Rows="1" Columns="3" Margin="0,0,0,12">
<ToggleButton Height="38" Margin="0,0,2,0"
IsChecked="{Binding TempControl.IsHeaterOn}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Fire16" FontSize="13" Margin="0,0,3,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.Heater}" VerticalAlignment="Center" FontSize="11"/>
</StackPanel>
</ToggleButton>
<ToggleButton Height="38" Margin="2,0,2,0"
IsChecked="{Binding TempControl.IsDepositCoolerOn}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="ArrowDown16" FontSize="13" Margin="0,0,3,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.DepositCooler}" VerticalAlignment="Center" FontSize="11"/>
</StackPanel>
</ToggleButton>
<ToggleButton Height="38" Margin="2,0,0,0"
IsChecked="{Binding TempControl.IsTinCoolerOn}"
Style="{StaticResource FluentStateToggle}">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Drop16" FontSize="13" Margin="0,0,3,0"/>
<TextBlock Text="{DynamicResource Bench.Actuators.TinCooler}" VerticalAlignment="Center" FontSize="11"/>
</StackPanel>
</ToggleButton>
</UniformGrid>
<!-- ── Divider ─────────────────────────────────────────────── -->
<Border Height="1" Background="{DynamicResource ControlStrokeColorDefaultBrush}"
Margin="0,0,0,10"/>
<!-- ── Misc relays ─────────────────────────────────────────── -->
<TextBlock Text="{DynamicResource Bench.Actuators.Relays}"
FontSize="11" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,6"/>
<UniformGrid Rows="1" Columns="3">
<ToggleButton Height="38" Margin="0,0,2,0"
IsChecked="{Binding RelayBank.IsElectronicOn}"
Style="{StaticResource FluentStateToggle}">
<TextBlock Text="{DynamicResource Bench.Actuators.Electronic}" FontSize="11"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</ToggleButton>
<ToggleButton Height="38" Margin="2,0,2,0"
IsChecked="{Binding RelayBank.IsFlasherOn}"
Style="{StaticResource FluentStateToggle}">
<TextBlock Text="{DynamicResource Bench.Actuators.Flasher}" FontSize="11"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</ToggleButton>
<ToggleButton Height="38" Margin="2,0,0,0"
IsChecked="{Binding RelayBank.IsPulse4SignalOn}"
Style="{StaticResource FluentStateToggle}">
<TextBlock Text="{DynamicResource Bench.Actuators.Pulse4}" FontSize="11"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</ToggleButton>
</UniformGrid>
</StackPanel>
</Border>
</UserControl>