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>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="K-Line Fault Codes"
|
||||
Title="{DynamicResource Dialog.KlineErrors.Title}"
|
||||
Height="400" Width="600"
|
||||
ResizeMode="CanResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
@@ -28,12 +28,12 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Fault codes:" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{DynamicResource Dialog.KlineErrors.Header}" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold"/>
|
||||
|
||||
<Button Grid.Column="1" Content="Read" Margin="0,2,8,2"
|
||||
<Button Grid.Column="1" Content="{DynamicResource Dialog.KlineErrors.Read}" Margin="0,2,8,2"
|
||||
Width="75" Height="24"
|
||||
Command="{Binding ReadErrorsCommand}"/>
|
||||
<Button Grid.Column="2" Content="Clear" Margin="0,2,0,2"
|
||||
<Button Grid.Column="2" Content="{DynamicResource Dialog.KlineErrors.Clear}" Margin="0,2,0,2"
|
||||
Width="75" Height="24"
|
||||
Command="{Binding ClearErrorsCommand}"/>
|
||||
</Grid>
|
||||
@@ -56,7 +56,7 @@
|
||||
<ProgressBar Value="{Binding ProgressPercent, Mode=OneWay}"
|
||||
Minimum="0" Maximum="100"
|
||||
VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<Button Grid.Column="1" Content="Close" Width="80" Height="24"
|
||||
<Button Grid.Column="1" Content="{DynamicResource Common.Close}" Width="80" Height="24"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding CloseCommand}"/>
|
||||
</Grid>
|
||||
|
||||
57
Views/Dialogs/OilPumpConfirmDialog.xaml
Normal file
57
Views/Dialogs/OilPumpConfirmDialog.xaml
Normal file
@@ -0,0 +1,57 @@
|
||||
<Window x:Class="HC_APTBS.Views.Dialogs.OilPumpConfirmDialog"
|
||||
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"
|
||||
Title="{DynamicResource Dialog.OilPump.Title}"
|
||||
Height="220" Width="440"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid Margin="16,12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="48"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Warning icon -->
|
||||
<TextBlock Grid.RowSpan="4" Text="⚠"
|
||||
FontSize="36" Foreground="DarkOrange"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||
Margin="0,4,8,0"/>
|
||||
|
||||
<!-- Title -->
|
||||
<TextBlock Grid.Column="1" Text="{DynamicResource Common.Warning}"
|
||||
FontSize="18" FontWeight="Bold" Foreground="DarkOrange"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<!-- Warning message -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" TextWrapping="Wrap"
|
||||
Margin="0,0,0,12"
|
||||
Text="{DynamicResource Dialog.OilPump.Message}"/>
|
||||
|
||||
<!-- Confirmation checkbox -->
|
||||
<CheckBox Grid.Row="2" Grid.Column="1" Margin="0,4"
|
||||
IsChecked="{Binding LeaksChecked}"
|
||||
FontSize="14" FontWeight="SemiBold">
|
||||
<TextBlock Text="{DynamicResource Dialog.OilPump.LeaksChecked}" TextWrapping="Wrap"/>
|
||||
</CheckBox>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="4" Grid.Column="1"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<Button Content="{DynamicResource Common.Accept}" Width="80" Height="26" Margin="0,0,8,0"
|
||||
Command="{Binding AcceptCommand}"/>
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="80" Height="26"
|
||||
Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
20
Views/Dialogs/OilPumpConfirmDialog.xaml.cs
Normal file
20
Views/Dialogs/OilPumpConfirmDialog.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Windows;
|
||||
using HC_APTBS.ViewModels.Dialogs;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Confirmation dialog shown before activating the oil pump relay.
|
||||
/// Equivalent to the old <c>WAcceptOilTurnOn</c>.
|
||||
/// </summary>
|
||||
public partial class OilPumpConfirmDialog : Window
|
||||
{
|
||||
/// <summary>Creates the dialog and wires the ViewModel.</summary>
|
||||
public OilPumpConfirmDialog(OilPumpConfirmViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
vm.RequestClose += Close;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="Generate Report"
|
||||
Title="{DynamicResource Dialog.Report.Title}"
|
||||
Height="450" Width="800"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
@@ -28,11 +28,11 @@
|
||||
Grid.Column="2" Grid.RowSpan="5" Margin="-3,10,0,0"/>
|
||||
|
||||
<!-- ── Section headers ─────────────────────────────────────────────── -->
|
||||
<TextBlock Text="Client List" FontSize="14" FontWeight="SemiBold"
|
||||
<TextBlock Text="{DynamicResource Dialog.Report.ClientList}" FontSize="14" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10"/>
|
||||
<TextBlock Grid.Column="1" Text="Client Data" FontSize="20" FontWeight="SemiBold"
|
||||
<TextBlock Grid.Column="1" Text="{DynamicResource Dialog.Report.ClientData}" FontSize="20" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10"/>
|
||||
<TextBlock Grid.Column="2" Text="Company Data" FontSize="20" FontWeight="SemiBold"
|
||||
<TextBlock Grid.Column="2" Text="{DynamicResource Dialog.Report.CompanyData}" FontSize="20" FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10"/>
|
||||
|
||||
<!-- ── Client list ─────────────────────────────────────────────────── -->
|
||||
@@ -47,17 +47,17 @@
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Name:" VerticalAlignment="Center" FontSize="13"/>
|
||||
<Label Content="{DynamicResource Dialog.Report.Name}" VerticalAlignment="Center" FontSize="13"/>
|
||||
<ComboBox Grid.Column="1" IsEditable="True"
|
||||
ItemsSource="{Binding ClientNames}"
|
||||
Text="{Binding SelectedClientName, UpdateSourceTrigger=PropertyChanged}"
|
||||
VerticalAlignment="Center" FontSize="13" Margin="4,0"/>
|
||||
<Button Grid.Column="2" Content="Save" Width="60" Height="24"
|
||||
<Button Grid.Column="2" Content="{DynamicResource Common.Save}" Width="60" Height="24"
|
||||
Command="{Binding SaveClientCommand}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- ── Client info text ─────────────────────────────────────────────── -->
|
||||
<GroupBox Grid.Column="1" Grid.Row="2" Header="Client information"
|
||||
<GroupBox Grid.Column="1" Grid.Row="2" Header="{DynamicResource Dialog.Report.ClientInfo}"
|
||||
Margin="8,0,8,4" FontSize="13">
|
||||
<TextBox Text="{Binding ClientInfo, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" AcceptsReturn="True"
|
||||
@@ -65,7 +65,7 @@
|
||||
</GroupBox>
|
||||
|
||||
<!-- ── Observations ─────────────────────────────────────────────────── -->
|
||||
<GroupBox Grid.Column="1" Grid.Row="3" Header="Observations"
|
||||
<GroupBox Grid.Column="1" Grid.Row="3" Header="{DynamicResource Dialog.Report.Observations}"
|
||||
Margin="8,0,8,4" FontSize="13">
|
||||
<TextBox Text="{Binding Observations, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap"
|
||||
@@ -78,7 +78,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Operator:" VerticalAlignment="Center" FontSize="13"/>
|
||||
<Label Content="{DynamicResource Dialog.Report.Operator}" VerticalAlignment="Center" FontSize="13"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding OperatorName, UpdateSourceTrigger=PropertyChanged}"
|
||||
VerticalAlignment="Center" FontSize="13" Margin="4,0" Height="24"
|
||||
IsReadOnly="True" Background="#F0F0F0"/>
|
||||
@@ -95,11 +95,11 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Company:" VerticalAlignment="Center" FontSize="13"/>
|
||||
<Label Content="{DynamicResource Dialog.Report.Company}" VerticalAlignment="Center" FontSize="13"/>
|
||||
<TextBox Grid.Column="1" Text="{Binding CompanyName, UpdateSourceTrigger=PropertyChanged}"
|
||||
VerticalAlignment="Center" FontSize="13" Margin="4,0" Height="24"/>
|
||||
</Grid>
|
||||
<GroupBox Grid.Row="1" Header="Company information"
|
||||
<GroupBox Grid.Row="1" Header="{DynamicResource Dialog.Report.CompanyInfo}"
|
||||
Margin="0,4,0,0" FontSize="13">
|
||||
<TextBox Text="{Binding CompanyInfo, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" AcceptsReturn="True"
|
||||
@@ -109,15 +109,15 @@
|
||||
|
||||
<!-- ── Buttons row ──────────────────────────────────────────────────── -->
|
||||
<Button Grid.Row="4" Grid.Column="0"
|
||||
Content="Delete Client" Padding="6,2" Margin="10,8,0,8"
|
||||
Content="{DynamicResource Dialog.Report.DeleteClient}" Padding="6,2" Margin="10,8,0,8"
|
||||
HorizontalAlignment="Left"
|
||||
Command="{Binding DeleteClientCommand}"/>
|
||||
|
||||
<StackPanel Grid.Row="4" Grid.Column="2"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,8,10,8">
|
||||
<Button Content="Generate" Width="80" Height="24" Margin="0,0,8,0"
|
||||
<Button Content="{DynamicResource Dialog.Report.Generate}" Width="80" Height="24" Margin="0,0,8,0"
|
||||
Command="{Binding AcceptCommand}"/>
|
||||
<Button Content="Cancel" Width="80" Height="24"
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="80" Height="24"
|
||||
Command="{Binding CancelCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
63
Views/Dialogs/RpmSafetyWarningDialog.xaml
Normal file
63
Views/Dialogs/RpmSafetyWarningDialog.xaml
Normal file
@@ -0,0 +1,63 @@
|
||||
<Window x:Class="HC_APTBS.Views.Dialogs.RpmSafetyWarningDialog"
|
||||
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"
|
||||
Title="{DynamicResource Dialog.RpmSafety.Title}"
|
||||
Height="260" Width="460"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid Margin="16,12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="48"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Warning icon -->
|
||||
<TextBlock Grid.RowSpan="5" Text="⚠"
|
||||
FontSize="36" Foreground="DarkOrange"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||
Margin="0,4,8,0"/>
|
||||
|
||||
<!-- Title -->
|
||||
<TextBlock Grid.Column="1" Text="{DynamicResource Common.Warning}"
|
||||
FontSize="18" FontWeight="Bold" Foreground="DarkOrange"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<!-- Warning message -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" TextWrapping="Wrap"
|
||||
Margin="0,0,0,12"
|
||||
Text="{DynamicResource Dialog.RpmSafety.Message}"/>
|
||||
|
||||
<!-- Option 1: Turn on oil and proceed -->
|
||||
<RadioButton Grid.Row="2" Grid.Column="1" Margin="0,4"
|
||||
GroupName="RpmSafety"
|
||||
IsChecked="{Binding IsOilAndProceedSelected}"
|
||||
Content="{DynamicResource Dialog.RpmSafety.OilAndProceed}"/>
|
||||
|
||||
<!-- Option 2: Proceed without oil -->
|
||||
<RadioButton Grid.Row="3" Grid.Column="1" Margin="0,4"
|
||||
GroupName="RpmSafety"
|
||||
IsChecked="{Binding IsProceedWithoutOilSelected}"
|
||||
Content="{DynamicResource Dialog.RpmSafety.ProceedWithout}"/>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="5" Grid.Column="1"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<Button Content="{DynamicResource Common.Accept}" Width="80" Height="26" Margin="0,0,8,0"
|
||||
Command="{Binding AcceptCommand}"/>
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="80" Height="26"
|
||||
Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
20
Views/Dialogs/RpmSafetyWarningDialog.xaml.cs
Normal file
20
Views/Dialogs/RpmSafetyWarningDialog.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Windows;
|
||||
using HC_APTBS.ViewModels.Dialogs;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Safety warning dialog shown when the operator starts the bench motor
|
||||
/// while the oil pump is OFF. Equivalent to the old <c>WCareOnRpmOn</c>.
|
||||
/// </summary>
|
||||
public partial class RpmSafetyWarningDialog : Window
|
||||
{
|
||||
/// <summary>Creates the dialog and wires the ViewModel.</summary>
|
||||
public RpmSafetyWarningDialog(RpmSafetyWarningViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
vm.RequestClose += Close;
|
||||
}
|
||||
}
|
||||
}
|
||||
333
Views/Dialogs/SettingsDialog.xaml
Normal file
333
Views/Dialogs/SettingsDialog.xaml
Normal file
@@ -0,0 +1,333 @@
|
||||
<Window x:Class="HC_APTBS.Views.Dialogs.SettingsDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="{DynamicResource Dialog.Settings.Title}"
|
||||
Height="560" Width="680"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
FontFamily="Ebrima"
|
||||
Background="#FFEDEDED">
|
||||
|
||||
<DockPanel Margin="8">
|
||||
|
||||
<!-- ── Bottom button bar ─────────────────────────────────────────── -->
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right" Margin="0,8,0,0">
|
||||
<Button Content="{DynamicResource Common.Accept}" Width="80" Height="26"
|
||||
Margin="0,0,8,0" Command="{Binding AcceptCommand}" IsDefault="True"/>
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="80" Height="26"
|
||||
Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ── Tab control ───────────────────────────────────────────────── -->
|
||||
<TabControl>
|
||||
|
||||
<!-- ══ General ══════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.General}">
|
||||
<StackPanel Margin="16">
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.Language}"
|
||||
FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<ComboBox ItemsSource="{Binding AvailableLanguages}"
|
||||
SelectedItem="{Binding SelectedLanguage}"
|
||||
Width="120" HorizontalAlignment="Left"/>
|
||||
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.DaysKeepLogs}"
|
||||
FontWeight="SemiBold" Margin="0,16,0,4"/>
|
||||
<TextBox Text="{Binding DaysKeepLogs, UpdateSourceTrigger=LostFocus}"
|
||||
Width="80" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ Safety ═══════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.Safety}">
|
||||
<Grid Margin="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Dialog.Settings.TempMax}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TempMax, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Dialog.Settings.TempMin}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding TempMin, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource Dialog.Settings.SecurityRpmLimit}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SecurityRpmLimit, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource Dialog.Settings.MaxPressureBar}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding MaxPressureBar, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="{DynamicResource Dialog.Settings.ToleranceUp}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding ToleranceUpExtension, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="{DynamicResource Dialog.Settings.TolerancePfp}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding TolerancePfpExtension, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Content="{DynamicResource Dialog.Settings.IgnoreTin}"
|
||||
IsChecked="{Binding DefaultIgnoreTin}" Margin="0,4,0,0"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ PID ══════════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.Pid}">
|
||||
<Grid Margin="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Dialog.Settings.PidP}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding PidP, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Dialog.Settings.PidI}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding PidI, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource Dialog.Settings.PidD}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding PidD, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource Dialog.Settings.PidLoopMs}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding PidLoopMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ Motor ════════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.Motor}">
|
||||
<DockPanel Margin="16">
|
||||
<!-- Top: motor parameters -->
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Dialog.Settings.EncoderRes}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding EncoderResolution, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Dialog.Settings.VoltMaxRpm}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding VoltageForMaxRpm, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource Dialog.Settings.MaxRpm}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding MaxRpm, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Content="{DynamicResource Dialog.Settings.RightRelay}"
|
||||
IsChecked="{Binding RightRelayValue}" Margin="0,4,0,0"/>
|
||||
</Grid>
|
||||
|
||||
<!-- RPM-Voltage relation table -->
|
||||
<GroupBox Margin="0,12,0,0">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.Relations}" FontWeight="SemiBold"/>
|
||||
</GroupBox.Header>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="0,4,0,0">
|
||||
<Button Content="{DynamicResource Dialog.Settings.AddRow}"
|
||||
Command="{Binding AddRelationCommand}"
|
||||
Width="75" Margin="0,0,8,0"/>
|
||||
<Button Content="{DynamicResource Dialog.Settings.RemoveRow}"
|
||||
Command="{Binding RemoveRelationCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=RelationsGrid}"
|
||||
Width="75"/>
|
||||
</StackPanel>
|
||||
<DataGrid x:Name="RelationsGrid"
|
||||
ItemsSource="{Binding Relations}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
SelectionMode="Single"
|
||||
HeadersVisibility="Column"
|
||||
GridLinesVisibility="Horizontal"
|
||||
MinHeight="120">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="*">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.RelRpm}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Rpm}" VerticalAlignment="Center" Margin="4,0"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Rpm, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="*">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.RelVoltage}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Voltage}" VerticalAlignment="Center" Margin="4,0"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ Company ══════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.Company}">
|
||||
<StackPanel Margin="16">
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.CompanyName}"
|
||||
FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<TextBox Text="{Binding CompanyName, UpdateSourceTrigger=LostFocus}"/>
|
||||
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.CompanyInfo}"
|
||||
FontWeight="SemiBold" Margin="0,12,0,4"/>
|
||||
<TextBox Text="{Binding CompanyInfo, UpdateSourceTrigger=LostFocus}"
|
||||
TextWrapping="Wrap" AcceptsReturn="True" Height="80"
|
||||
VerticalScrollBarVisibility="Auto"/>
|
||||
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.ReportLogo}"
|
||||
FontWeight="SemiBold" Margin="0,12,0,4"/>
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right" Content="..." Width="30"
|
||||
Margin="4,0,0,0" Command="{Binding BrowseLogoCommand}"/>
|
||||
<TextBox Text="{Binding ReportLogoPath, UpdateSourceTrigger=LostFocus}"
|
||||
IsReadOnly="True" Background="#F0F0F0"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ K-Line ═══════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.KLine}">
|
||||
<StackPanel Margin="16">
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.KLinePort}"
|
||||
FontWeight="SemiBold" Margin="0,0,0,4"/>
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right"
|
||||
Content="{DynamicResource Dialog.Settings.RefreshPorts}"
|
||||
Margin="8,0,0,0" Width="80"
|
||||
Command="{Binding RefreshPortsCommand}"/>
|
||||
<ComboBox ItemsSource="{Binding AvailablePorts}"
|
||||
SelectedItem="{Binding SelectedKLinePort}"
|
||||
IsEditable="True"
|
||||
Text="{Binding SelectedKLinePort, UpdateSourceTrigger=LostFocus}"/>
|
||||
</DockPanel>
|
||||
<TextBlock Text="{DynamicResource Dialog.Settings.KLineHint}"
|
||||
FontStyle="Italic" Foreground="Gray" Margin="0,8,0,0"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<!-- ══ Advanced ═════════════════════════════════════════════════ -->
|
||||
<TabItem Header="{DynamicResource Dialog.Settings.Tab.Advanced}">
|
||||
<Grid Margin="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource Dialog.Settings.RefreshBench}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding RefreshBenchInterfaceMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource Dialog.Settings.RefreshReading}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding RefreshWhileReadingMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource Dialog.Settings.RefreshCanBus}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding RefreshCanBusReadMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource Dialog.Settings.RefreshPumpReq}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding RefreshPumpRequestMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="{DynamicResource Dialog.Settings.RefreshPumpParams}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding RefreshPumpParamsMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="{DynamicResource Dialog.Settings.BlinkInterval}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding BlinkIntervalMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<TextBlock Grid.Row="6" Grid.Column="0" Text="{DynamicResource Dialog.Settings.FlasherInterval}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,6"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding FlasherIntervalMs, UpdateSourceTrigger=LostFocus}"
|
||||
Margin="0,0,0,6"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
18
Views/Dialogs/SettingsDialog.xaml.cs
Normal file
18
Views/Dialogs/SettingsDialog.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Windows;
|
||||
using HC_APTBS.ViewModels.Dialogs;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Dialog for editing all application settings.
|
||||
/// </summary>
|
||||
public partial class SettingsDialog : Window
|
||||
{
|
||||
public SettingsDialog(SettingsViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
vm.RequestClose += Close;
|
||||
}
|
||||
}
|
||||
}
|
||||
138
Views/Dialogs/UnlockProgressDialog.xaml
Normal file
138
Views/Dialogs/UnlockProgressDialog.xaml
Normal file
@@ -0,0 +1,138 @@
|
||||
<Window x:Class="HC_APTBS.Views.Dialogs.UnlockProgressDialog"
|
||||
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"
|
||||
Title="{DynamicResource Dialog.Unlock.Title}"
|
||||
Height="360" Width="340"
|
||||
WindowStyle="None" ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Topmost="True"
|
||||
Background="#FF2B2929"
|
||||
MouseLeftButtonDown="OnMouseDrag"
|
||||
Closing="OnWindowClosing">
|
||||
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="210"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Unlock type label -->
|
||||
<TextBlock Grid.Row="0"
|
||||
Text="{Binding UnlockTypeLabel, Mode=OneWay}"
|
||||
FontSize="14" Foreground="#AAAAAA"
|
||||
HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
|
||||
<!-- Progress ring area -->
|
||||
<Grid Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<!-- Background ring -->
|
||||
<Ellipse Width="200" Height="200"
|
||||
Stroke="#4D4D4D" StrokeThickness="10"
|
||||
Fill="Transparent"/>
|
||||
|
||||
<!-- Content inside ring -->
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Text="{DynamicResource Dialog.Unlock.Progress}"
|
||||
FontSize="12" Foreground="#888888"
|
||||
HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
|
||||
<!-- Percentage -->
|
||||
<TextBlock FontSize="60" FontFamily="Courier New"
|
||||
Foreground="White" HorizontalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<Binding Path="Progress" Mode="OneWay"
|
||||
StringFormat="{}{0}%"/>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Elapsed time -->
|
||||
<TextBlock Text="{Binding ElapsedTime, Mode=OneWay}"
|
||||
FontSize="16" FontFamily="Courier New"
|
||||
Foreground="#CCCCCC" HorizontalAlignment="Center"
|
||||
Margin="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Phase text -->
|
||||
<TextBlock Grid.Row="2"
|
||||
Text="{Binding PhaseText, Mode=OneWay}"
|
||||
FontSize="16" Foreground="White"
|
||||
HorizontalAlignment="Center" Margin="0,4,0,6"/>
|
||||
|
||||
<!-- Progress bar -->
|
||||
<ProgressBar Grid.Row="3"
|
||||
Value="{Binding Progress, Mode=OneWay}"
|
||||
Minimum="0" Maximum="100"
|
||||
Height="12" Margin="8,0"
|
||||
Foreground="#00EC00" Background="#3D3D3D"/>
|
||||
|
||||
<!-- Result text — overlays the spacer row so it never displaces buttons -->
|
||||
<TextBlock Grid.Row="4"
|
||||
Text="{Binding ResultText, Mode=OneWay}"
|
||||
FontSize="22" FontWeight="Bold"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsComplete, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="#FF5858"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSuccess}" Value="True">
|
||||
<Setter Property="Foreground" Value="#00EC00"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="5" Orientation="Horizontal"
|
||||
HorizontalAlignment="Center" Margin="0,8,0,0">
|
||||
<!-- Cancel button -->
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="90" Height="30"
|
||||
Margin="0,0,12,0"
|
||||
Command="{Binding CancelCommand}"
|
||||
Foreground="White" FontWeight="Bold">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#FF5858"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="#4D4D4D"/>
|
||||
<Setter Property="Foreground" Value="#888888"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
|
||||
<!-- Close button -->
|
||||
<Button Content="{DynamicResource Common.Close}" Width="90" Height="30"
|
||||
Command="{Binding CloseCommand}"
|
||||
Foreground="White" FontWeight="Bold">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="#4D4D4D"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="True">
|
||||
<Setter Property="Background" Value="#337AB7"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="#888888"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
49
Views/Dialogs/UnlockProgressDialog.xaml.cs
Normal file
49
Views/Dialogs/UnlockProgressDialog.xaml.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using HC_APTBS.ViewModels.Dialogs;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Non-modal window showing immobilizer unlock progress.
|
||||
/// Prevents user-initiated closing until the unlock sequence completes;
|
||||
/// programmatic close via <see cref="ForceClose"/> always succeeds.
|
||||
/// Equivalent to the old <c>WUnlocker</c> window.
|
||||
/// </summary>
|
||||
public partial class UnlockProgressDialog : Window
|
||||
{
|
||||
private bool _forceClose;
|
||||
|
||||
/// <summary>Creates the dialog and wires the ViewModel.</summary>
|
||||
public UnlockProgressDialog(UnlockProgressViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
vm.RequestClose += ForceClose;
|
||||
}
|
||||
|
||||
/// <summary>Closes the window unconditionally (bypasses the completion guard).</summary>
|
||||
public void ForceClose()
|
||||
{
|
||||
_forceClose = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>Allows dragging the borderless window by clicking anywhere.</summary>
|
||||
private void OnMouseDrag(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
/// <summary>Prevents user-initiated closing while the unlock sequence is still running.</summary>
|
||||
private void OnWindowClosing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (_forceClose) return;
|
||||
|
||||
if (DataContext is UnlockProgressViewModel vm && !vm.IsComplete)
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="User Authentication"
|
||||
Title="{DynamicResource Dialog.UserCheck.Title}"
|
||||
Height="170" Width="420"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
@@ -21,12 +21,12 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Username -->
|
||||
<Label Content="Username:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<Label Content="{DynamicResource Dialog.UserCheck.Username}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Column="1" Margin="8,4" Height="26" VerticalContentAlignment="Center"
|
||||
Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<!-- Password -->
|
||||
<Label Grid.Row="1" Content="Password:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<Label Grid.Row="1" Content="{DynamicResource Dialog.UserCheck.Password}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<PasswordBox x:Name="PBPassword" Grid.Row="1" Grid.Column="1"
|
||||
Margin="8,4" Height="26" VerticalContentAlignment="Center"
|
||||
PasswordChanged="OnPasswordChanged"/>
|
||||
@@ -34,9 +34,9 @@
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="1"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
||||
<Button Content="Accept" Width="80" Height="26" Margin="0,0,8,0"
|
||||
<Button Content="{DynamicResource Common.Accept}" Width="80" Height="26" Margin="0,0,8,0"
|
||||
Command="{Binding AcceptCommand}" IsDefault="True"/>
|
||||
<Button Content="Cancel" Width="80" Height="26"
|
||||
<Button Content="{DynamicResource Common.Cancel}" Width="80" Height="26"
|
||||
Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
59
Views/Dialogs/VoltageWarningDialog.xaml
Normal file
59
Views/Dialogs/VoltageWarningDialog.xaml
Normal file
@@ -0,0 +1,59 @@
|
||||
<Window x:Class="HC_APTBS.Views.Dialogs.VoltageWarningDialog"
|
||||
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"
|
||||
Title="{DynamicResource Dialog.Voltage.Title}"
|
||||
Height="200" Width="420"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid Margin="16,12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="48"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Voltage icon -->
|
||||
<TextBlock Grid.RowSpan="4" Text="⚡"
|
||||
FontSize="36" Foreground="#D4A017"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Center"
|
||||
Margin="0,4,8,0"/>
|
||||
|
||||
<!-- Title with voltage -->
|
||||
<TextBlock Grid.Column="1" FontSize="18" FontWeight="Bold" Foreground="DarkOrange"
|
||||
Margin="0,0,0,8">
|
||||
<Run Text="VOLTAGE: "/>
|
||||
<Run Text="{Binding Voltage, Mode=OneWay}"/>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Info message -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" TextWrapping="Wrap" Margin="0,0,0,4">
|
||||
<Run Text="The selected pump requires "/>
|
||||
<Run Text="{Binding Voltage, Mode=OneWay}" FontWeight="Bold"/>
|
||||
<Run Text=" power supply."/>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Action text -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" TextWrapping="Wrap"
|
||||
FontSize="14" FontWeight="Bold" Foreground="DarkRed"
|
||||
Margin="0,4,0,0">
|
||||
<Run Text="SWITCH THE POWER SUPPLY TO "/>
|
||||
<Run Text="{Binding Voltage, Mode=OneWay}"/>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Acknowledge button -->
|
||||
<Button Grid.Row="4" Grid.Column="1"
|
||||
Content="{DynamicResource Common.Ok}" Width="80" Height="26"
|
||||
HorizontalAlignment="Right" Margin="0,12,0,0"
|
||||
Command="{Binding AcknowledgeCommand}" IsDefault="True"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
20
Views/Dialogs/VoltageWarningDialog.xaml.cs
Normal file
20
Views/Dialogs/VoltageWarningDialog.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Windows;
|
||||
using HC_APTBS.ViewModels.Dialogs;
|
||||
|
||||
namespace HC_APTBS.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Informational dialog warning the operator to switch the power supply
|
||||
/// voltage before testing a pump. Equivalent to the old <c>WAlert27v</c>.
|
||||
/// </summary>
|
||||
public partial class VoltageWarningDialog : Window
|
||||
{
|
||||
/// <summary>Creates the dialog and wires the ViewModel.</summary>
|
||||
public VoltageWarningDialog(VoltageWarningViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
vm.RequestClose += Close;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user