Files
HC_APTBS/Views/UserControls/PumpControlView.xaml
LucianoDev 37d099cdbd feat: add Ford VP44 unlock progress dialog, K-Line fast unlock, localization, safety dialogs, and settings
Unlock progress UI:
- UnlockProgressDialog with dark-themed progress ring, phase indicator, elapsed
  time, and cancel/close buttons (non-modal, draggable borderless window)
- UnlockProgressViewModel with event-driven progress tracking via IUnlockService
- Triggers on pump selection (manual or K-Line auto-detect), not test start

UnlockService rewrite:
- Persistent CAN senders that outlive the unlock sequence (StopSenders on pump change)
- Concurrent K-Line fast unlock: awaits session Connected, sends RAM timer shortcut
  ({02 88 02 03 A8 01 00}), verifies via CAN TestUnlock before skipping wait
- Fix Type 1 verification (Value == 0 means unlocked, was inverted)

K-Line fast unlock support:
- IKwpService.TryFastUnlockAsync / KwpService implementation

Additional features:
- ILocalizationService with ES/EN resource dictionaries and runtime switching
- Safety dialogs: VoltageWarning, OilPumpConfirm, RpmSafetyWarning
- SettingsDialog for app configuration
- BenchService enhancements, ConfigurationService improvements, PDF report updates
- All UI strings localized via DynamicResource

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-16 13:22:48 +02:00

195 lines
12 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.PumpControlView"
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"
mc:Ignorable="d"
d:DesignHeight="260" d:DesignWidth="440"
IsEnabled="{Binding IsEnabled}">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<!-- Shared style for the settings popup min/max/step text boxes -->
<Style x:Key="SettingsTextBox" TargetType="TextBox">
<Setter Property="Width" Value="40"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="FontSize" Value="14"/>
</Style>
<!-- Label inside settings popup -->
<Style x:Key="SettingsLabel" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="0,2,0,0"/>
</Style>
</UserControl.Resources>
<StackPanel>
<!-- ═══ FBKW — Advance Control ═══════════════════════════════════════ -->
<Grid Margin="6,6,6,2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource PumpCtrl.Fbkw}" HorizontalAlignment="Center"
FontSize="13" Foreground="Black" Margin="0,0,0,2"/>
<DockPanel Grid.Row="1" Margin="4,0,4,2">
<!-- Settings button -->
<ToggleButton x:Name="FbkwSettingsToggle" DockPanel.Dock="Left"
Width="28" Height="28" Margin="0,0,4,0"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="14"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<!-- Numeric text box -->
<TextBox DockPanel.Dock="Right" Width="50" Height="28" Margin="4,0,0,0"
TextAlignment="Center" VerticalContentAlignment="Center"
FontWeight="Bold" FontSize="13"
Text="{Binding FbkwValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"/>
<!-- Slider -->
<Slider Minimum="{Binding FbkwMin}" Maximum="{Binding FbkwMax}"
Value="{Binding FbkwValue}" TickFrequency="{Binding FbkwStep}"
TickPlacement="BottomRight" AutoToolTipPrecision="2"
IsSnapToTickEnabled="True" VerticalAlignment="Center"
Focusable="False" Foreground="Black"/>
</DockPanel>
<!-- Settings popup -->
<Popup IsOpen="{Binding IsChecked, ElementName=FbkwSettingsToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True"
HorizontalOffset="30">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwMin, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwStep, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding FbkwMax, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</Grid>
<!-- ═══ ME — Quantity Control ════════════════════════════════════════ -->
<Grid Margin="6,4,6,2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource PumpCtrl.Me}" HorizontalAlignment="Center"
FontSize="13" Foreground="Black" Margin="0,0,0,2"/>
<DockPanel Grid.Row="1" Margin="4,0,4,2">
<ToggleButton x:Name="MeSettingsToggle" DockPanel.Dock="Left"
Width="28" Height="28" Margin="0,0,4,0"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="14"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<TextBox DockPanel.Dock="Right" Width="50" Height="28" Margin="4,0,0,0"
TextAlignment="Center" VerticalContentAlignment="Center"
FontWeight="Bold" FontSize="13"
Text="{Binding MeValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"/>
<Slider Minimum="{Binding MeMin}" Maximum="{Binding MeMax}"
Value="{Binding MeValue}" TickFrequency="{Binding MeStep}"
TickPlacement="BottomRight" AutoToolTipPrecision="2"
IsSnapToTickEnabled="False" VerticalAlignment="Center"
Focusable="False" Foreground="Black"/>
</DockPanel>
<Popup IsOpen="{Binding IsChecked, ElementName=MeSettingsToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True"
HorizontalOffset="30">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeMin, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeStep, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding MeMax, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</Grid>
<!-- ═══ PreIn — Pre-injection Quantity ═══════════════════════════════ -->
<Grid Margin="6,4,6,2"
Visibility="{Binding IsPreInVisible, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="{DynamicResource PumpCtrl.PreInj}" HorizontalAlignment="Center"
FontSize="13" Foreground="Black" Margin="0,0,0,2"/>
<DockPanel Grid.Row="1" Margin="4,0,4,2">
<ToggleButton x:Name="PreInSettingsToggle" DockPanel.Dock="Left"
Width="28" Height="28" Margin="0,0,4,0"
Background="Transparent" BorderBrush="Transparent"
Content="..." FontWeight="Bold" FontSize="14"
ToolTip="{DynamicResource PumpCtrl.MinStepMax}"/>
<TextBox DockPanel.Dock="Right" Width="50" Height="28" Margin="4,0,0,0"
TextAlignment="Center" VerticalContentAlignment="Center"
FontWeight="Bold" FontSize="13"
Text="{Binding PreInValue, UpdateSourceTrigger=PropertyChanged, StringFormat=F2}"/>
<Slider Minimum="{Binding PreInMin}" Maximum="{Binding PreInMax}"
Value="{Binding PreInValue}" TickFrequency="{Binding PreInStep}"
TickPlacement="BottomRight" AutoToolTipPrecision="2"
IsSnapToTickEnabled="True" VerticalAlignment="Center"
Focusable="False" Foreground="Black"/>
</DockPanel>
<Popup IsOpen="{Binding IsChecked, ElementName=PreInSettingsToggle}"
StaysOpen="False" Placement="Bottom" AllowsTransparency="True"
HorizontalOffset="30">
<Border Background="#BB000000" Padding="8,6" CornerRadius="3">
<UniformGrid Columns="3" Width="180">
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInMin, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Min}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInStep, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Step}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel HorizontalAlignment="Center">
<TextBox Text="{Binding PreInMax, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource SettingsTextBox}"/>
<TextBlock Text="{DynamicResource PumpCtrl.Max}" Style="{StaticResource SettingsLabel}" HorizontalAlignment="Center"/>
</StackPanel>
</UniformGrid>
</Border>
</Popup>
</Grid>
</StackPanel>
</UserControl>