Files
HC_APTBS/Views/UserControls/AdvanceMonitorCard.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

126 lines
7.5 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.AdvanceMonitorCard"
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"
xmlns:ctrl="clr-namespace:HC_APTBS.Views.Controls"
mc:Ignorable="d"
d:DesignHeight="560" d:DesignWidth="320">
<!--
Advance Monitor card — radial angle gauge, PSG/INJ readouts,
Δ° offset input, Zero PSG / Zero INJ buttons.
DataContext = BenchPageViewModel; all bindings go through AngleDisplay.*.
-->
<Border Style="{StaticResource PumpCard}">
<DockPanel LastChildFill="True">
<!-- ── Card header ─────────────────────────────────────────── -->
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,10">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="CompassNorthwest24" FontSize="16"
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Bench.Advance.Title}"
Style="{StaticResource PumpCardHeader}" Margin="0"/>
</DockPanel>
<!-- ── Zero buttons (docked bottom first) ─────────────────── -->
<UniformGrid DockPanel.Dock="Bottom" Rows="1" Columns="2" Margin="0,10,0,0">
<ui:Button Margin="0,0,4,0" Height="40"
Content="{DynamicResource Bench.Advance.ZeroPsg}"
Command="{Binding AngleDisplay.SetPsgZeroCommand}"
Appearance="Secondary"/>
<ui:Button Margin="4,0,0,0" Height="40"
Content="{DynamicResource Bench.Advance.ZeroInj}"
Command="{Binding AngleDisplay.SetInjZeroCommand}"
Appearance="Secondary"/>
</UniformGrid>
<!-- ── Δ° offset row (docked bottom) ──────────────────────── -->
<Grid DockPanel.Dock="Bottom" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{DynamicResource Bench.Advance.Delta}"
FontSize="13" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
VerticalAlignment="Center" Margin="0,0,8,0"/>
<TextBox Grid.Column="1"
Text="{Binding AngleDisplay.LockAngleDeltaInput,
UpdateSourceTrigger=PropertyChanged}"
FontFamily="Consolas" FontSize="16" FontWeight="SemiBold"
Height="36" VerticalContentAlignment="Center"
HorizontalContentAlignment="Right" Padding="8,0"/>
<Border Grid.Column="3"
Background="{DynamicResource ControlFillColorSecondaryBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1" CornerRadius="6" Padding="8,4">
<TextBlock Text="{Binding AngleDisplay.LockAngleDisplay}"
Foreground="{Binding AngleDisplay.LockAngleForeground}"
FontFamily="Consolas" FontSize="16" FontWeight="SemiBold"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
</Grid>
<!-- ── PSG / INJ mini readouts (docked bottom) ────────────── -->
<UniformGrid DockPanel.Dock="Bottom" Rows="1" Columns="2" Margin="0,10,0,0">
<!-- PSG -->
<Border Margin="0,0,4,0"
Background="{DynamicResource ControlFillColorSecondaryBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1" CornerRadius="6" Padding="10,8">
<StackPanel>
<TextBlock Text="PSG" FontSize="10" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,2"/>
<TextBlock Text="{Binding AngleDisplay.PsgRelativeAngle}"
Foreground="{Binding AngleDisplay.PsgAngleForeground}"
FontFamily="Consolas" FontSize="20" FontWeight="SemiBold"/>
<TextBlock Text="{Binding AngleDisplay.PsgEncoderAngle}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
FontFamily="Consolas" FontSize="11"
Margin="0,2,0,0"/>
</StackPanel>
</Border>
<!-- INJ -->
<Border Margin="4,0,0,0"
Background="{DynamicResource ControlFillColorSecondaryBrush}"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="1" CornerRadius="6" Padding="10,8">
<StackPanel>
<TextBlock Text="INJ" FontSize="10" FontWeight="SemiBold"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0,0,0,2"/>
<TextBlock Text="{Binding AngleDisplay.InjRelativeAngle}"
Foreground="{Binding AngleDisplay.InjAngleForeground}"
FontFamily="Consolas" FontSize="20" FontWeight="SemiBold"/>
<TextBlock Text="{Binding AngleDisplay.InjEncoderAngle}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
FontFamily="Consolas" FontSize="11"
Margin="0,2,0,0"/>
</StackPanel>
</Border>
</UniformGrid>
<!-- ── Radial gauge (fills remaining space) ────────────────── -->
<ctrl:RadialAngleGauge
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
MinHeight="200"
PrimaryAngle="{Binding AngleDisplay.PrimaryGaugeAngle}"
TargetAngle="{Binding AngleDisplay.TargetAngleForGauge}"
SecondaryAngle="{Binding AngleDisplay.SecondaryGaugeAngle}"
PrimaryBrush="{Binding AngleDisplay.PsgAngleForeground}"
TargetBrush="{Binding AngleDisplay.LockAngleForeground}"
IsRunningMode="{Binding AngleDisplay.IsRunningMode}"/>
</DockPanel>
</Border>
</UserControl>