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

127 lines
6.5 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.PhaseCardView"
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:DataContext="{d:DesignInstance Type=vm:PhaseCardViewModel, IsDesignTimeCreatable=False}">
<!--
Single phase card. DataContext: PhaseCardViewModel.
Shared between TestPlanView (shows ReadyValues/OperationValues and enable toggle)
and TestRunningView (shows live ResultIndicators and pass/fail colour).
-->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<!-- Simple Name: Value pair used by ReadyValues and OperationValues -->
<DataTemplate DataType="{x:Type vm:OperationValueViewModel}">
<StackPanel Orientation="Horizontal" Margin="0,0,6,0">
<TextBlock Text="{Binding Name}" FontSize="10" Foreground="Black"
Padding="0,0,2,0"/>
<TextBlock Text=":" FontSize="10" Foreground="Black"/>
<TextBlock Text="{Binding Value, StringFormat=F1}" FontSize="10"
Foreground="DimGray" Padding="2,0,0,0"
HorizontalAlignment="Right"/>
</StackPanel>
</DataTemplate>
<!-- Vertical progress bar indicator (wraps GraphicIndicatorView) -->
<DataTemplate DataType="{x:Type vm:GraphicIndicatorViewModel}">
<uc:GraphicIndicatorView/>
</DataTemplate>
</UserControl.Resources>
<Border MinWidth="100" Margin="2,0" Padding="4"
CornerRadius="2" SnapsToDevicePixels="True">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#F0F0F0"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Opacity" Value="1"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive}" Value="True">
<Setter Property="Background" Value="#FFE082"/>
<Setter Property="BorderBrush" Value="#F9A825"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsPassed}" Value="True">
<Setter Property="Background" Value="#C8E6C9"/>
<Setter Property="BorderBrush" Value="#388E3C"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsFailed}" Value="True">
<Setter Property="Background" Value="#FFCDD2"/>
<Setter Property="BorderBrush" Value="#C62828"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
<Setter Property="Background" Value="#E0E0E0"/>
<Setter Property="BorderBrush" Value="#BDBDBD"/>
<Setter Property="Opacity" Value="0.5"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid>
<!-- Enable/disable toggle -->
<CheckBox IsChecked="{Binding IsEnabled}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="0,0,0,0" ToolTip="Enable/disable this phase"/>
<StackPanel Margin="0,2,0,0">
<TextBlock Text="{Binding Name}"
FontSize="11" FontWeight="SemiBold"
HorizontalAlignment="Center"
TextWrapping="Wrap"
Margin="16,0,0,0"/>
<TextBlock Text="{DynamicResource Test.Critical}" FontSize="9"
Foreground="#E65100" FontWeight="Bold"
HorizontalAlignment="Center"
Visibility="{Binding IsCritical, Converter={StaticResource BoolToVis}}"/>
<StackPanel Visibility="{Binding ShowOperationValues, Converter={StaticResource BoolToVis}}"
Margin="0,3,0,0">
<StackPanel Visibility="{Binding ReadyValues.Count, FallbackValue=Collapsed}">
<TextBlock Text="{DynamicResource Test.Required}" FontSize="9" Foreground="#666"
FontWeight="SemiBold" Margin="0,1,0,0"/>
<ItemsControl ItemsSource="{Binding ReadyValues}"/>
</StackPanel>
<TextBlock Text="{DynamicResource Test.TestLabel}" FontSize="9" Foreground="#666"
FontWeight="SemiBold" Margin="0,2,0,0"/>
<ItemsControl ItemsSource="{Binding OperationValues}"/>
</StackPanel>
<ItemsControl ItemsSource="{Binding ResultIndicators}" Margin="0,4,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<TextBlock Text="{Binding ResultText}"
FontSize="12" FontWeight="Bold"
HorizontalAlignment="Center" Margin="0,3,0,0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="DimGray"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsPassed}" Value="True">
<Setter Property="Foreground" Value="#2E7D32"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsFailed}" Value="True">
<Setter Property="Foreground" Value="#B71C1C"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</Grid>
</Border>
</UserControl>