Files
HC_APTBS/Views/UserControls/TestRunningView.xaml
LucianoDev 0280a2fad1 feat: page-based navigation shell + Tests page wizard
Replace the monolithic MainWindow with a SelectedPage-driven shell
(Dashboard / Pump / Bench / Tests / Results / Settings). The Tests
page gets the Plan -> Preconditions -> Running -> Done wizard from
ui-structure.md \u00a74, backed by a 7-item precondition gate and
shared sub-views (PhaseCardView / TestSectionView / GraphicIndicatorView)
extracted from the now-deleted monolithic TestPanelView.

New VMs / views:
- Tests wizard: TestPreconditions, PhaseCard, GraphicIndicator,
  TestSection, TestPlan, TestRunning, TestDone
- Dashboard panels: DashboardConnection, DashboardReadings,
  DashboardAlarms, InterlockBanner, ResultHistory
- Pump / bench panels: PumpIdentificationPanel, PumpLiveData,
  UnlockPanel, BenchDriveControl, BenchReadings, RelayBank,
  TemperatureControl, DtcList, AuthGate
- Dialogs: generic ConfirmDialog, UserManageDialog, UserPromptDialog

Supporting changes:
- IsOilPumpOn exposed on MainViewModel for precondition evaluation
- RequiresAuth added to TestDefinition (XML round-trip)
- BipStatusDefinition + CompletedTestRun models
- ~35 new Test.* localization keys (en + es)
- Settings moved from modal dialog to full page
- Pause / Retry / Skip stubs in TestRunningView; full spec in
  docs/gap-test-running-controls.md for follow-up implementation
- docs/ui-structure.md captures the wizard design

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 13:11:34 +02:00

160 lines
7.7 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.TestRunningView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uc="clr-namespace:HC_APTBS.Views.UserControls"
xmlns:vm="clr-namespace:HC_APTBS.ViewModels"
mc:Ignorable="d"
d:DesignHeight="640" d:DesignWidth="1000"
Background="#FFEDEDED" Foreground="Black"
d:DataContext="{d:DesignInstance Type=vm:TestPanelViewModel, IsDesignTimeCreatable=False}">
<!--
Running step of the Tests wizard. DataContext: TestPanelViewModel.
Shows the active phase countdown, live phase-card updates, and the flowmeter /
angle visuals. Pause / Retry-phase / Skip-phase buttons are rendered disabled —
their IBenchService wiring is deferred (see docs/gap-test-running-controls.md).
-->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<DataTemplate DataType="{x:Type vm:TestSectionViewModel}">
<uc:TestSectionView/>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- Phase header + countdown -->
<RowDefinition Height="*"/> <!-- Sections + live charts -->
<RowDefinition Height="Auto"/> <!-- Control row -->
</Grid.RowDefinitions>
<!-- Phase header + countdown + progress -->
<Border Padding="10,8" BorderBrush="#DDD" BorderThickness="0,0,0,1"
Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding CurrentPhaseName}"
FontSize="16" FontWeight="SemiBold"
Foreground="#222"/>
<StackPanel Orientation="Horizontal" Margin="0,1,0,0">
<TextBlock Text="{Binding SectionLabel}"
FontSize="11" FontStyle="Italic"
Foreground="#666"/>
<TextBlock Text="{Binding StatusText}"
FontSize="11" FontStyle="Italic"
Foreground="Gray" Margin="8,0,0,0"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal"
VerticalAlignment="Center">
<TextBlock Text="{Binding PhaseRemainingSeconds, Mode=OneWay}"
FontSize="32" FontFamily="Impact"
Foreground="#1565C0"
VerticalAlignment="Center"/>
<TextBlock Text="s" FontSize="18"
Foreground="#1565C0"
VerticalAlignment="Bottom" Margin="2,0,0,4"/>
<TextBlock Foreground="#999" FontSize="11"
VerticalAlignment="Bottom" Margin="8,0,0,4">
<Run Text="/ "/>
<Run Text="{Binding PhaseTotalSeconds, Mode=OneWay}"/>
<Run Text="s"/>
</TextBlock>
</StackPanel>
<ProgressBar Grid.Row="1" Grid.ColumnSpan="2"
Minimum="0" Maximum="1"
Value="{Binding PhaseProgress, Mode=OneWay}"
Height="6" Margin="0,6,0,0"
Background="#EEE" Foreground="#1565C0"
BorderThickness="0"/>
</Grid>
</Border>
<!-- Main body: test sections on left, live charts on right -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="420"/>
</Grid.ColumnDefinitions>
<!-- Live phase-card list (read-only during run, cards colour themselves) -->
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding Tests}" Margin="4"/>
</ScrollViewer>
<!-- Charts + angle display -->
<Grid Grid.Column="1" Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<uc:FlowmeterChartView Grid.Row="0"
DataContext="{Binding DataContext.FlowmeterChart.Delivery,
RelativeSource={RelativeSource AncestorType=Window}}"/>
<uc:FlowmeterChartView Grid.Row="1"
DataContext="{Binding DataContext.FlowmeterChart.Over,
RelativeSource={RelativeSource AncestorType=Window}}"
Margin="0,4,0,0"/>
<uc:AngleDisplayView Grid.Row="2"
DataContext="{Binding DataContext.AngleDisplay,
RelativeSource={RelativeSource AncestorType=Window}}"
Margin="0,4,0,0"/>
</Grid>
</Grid>
<!-- Control row -->
<Border Grid.Row="2" Padding="10,8"
BorderBrush="#DDD" BorderThickness="0,1,0,0"
Background="White">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<Button Content="{DynamicResource Test.Running.Pause}"
IsEnabled="False"
ToolTip="{DynamicResource Test.Running.ComingSoon}"
Padding="12,5" FontSize="12" Margin="0,0,6,0"/>
<Button Content="{DynamicResource Test.Running.Retry}"
IsEnabled="False"
ToolTip="{DynamicResource Test.Running.ComingSoon}"
Padding="12,5" FontSize="12" Margin="0,0,6,0"/>
<Button Content="{DynamicResource Test.Running.Skip}"
IsEnabled="False"
ToolTip="{DynamicResource Test.Running.ComingSoon}"
Padding="12,5" FontSize="12"/>
</StackPanel>
<Button Grid.Column="2"
Content="{DynamicResource Test.Running.Abort}"
Command="{Binding DataContext.TestsPage.AbortCommand,
RelativeSource={RelativeSource AncestorType=Window}}"
Padding="18,6" FontSize="14" FontWeight="Bold"
Background="#C62828" Foreground="White" BorderThickness="0"/>
</Grid>
</Border>
</Grid>
</UserControl>