Files
HC_APTBS/Services/IConfigurationService.cs
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

84 lines
4.2 KiB
C#

using System.Collections.Generic;
using System.Collections.ObjectModel;
using HC_APTBS.Models;
namespace HC_APTBS.Services
{
/// <summary>
/// Provides read/write access to persisted application configuration.
/// Configuration files live under <c>%UserProfile%\.HC_APTBS\config\</c>.
/// </summary>
public interface IConfigurationService
{
// ── Settings ──────────────────────────────────────────────────────────────
/// <summary>Application-wide settings (temperature limits, PID, refresh rates, etc.).</summary>
AppSettings Settings { get; }
/// <summary>Persists <see cref="Settings"/> to <c>config.xml</c>.</summary>
void SaveSettings();
// ── Bench configuration ───────────────────────────────────────────────────
/// <summary>
/// Current bench CAN parameter map and relay definitions.
/// Loaded from <c>bench.xml</c> on first access.
/// </summary>
BenchConfiguration Bench { get; }
/// <summary>Persists <see cref="Bench"/> to <c>bench.xml</c>.</summary>
void SaveBench();
// ── Pump database ─────────────────────────────────────────────────────────
/// <summary>Returns all known pump IDs from the pump database.</summary>
IReadOnlyList<string> GetPumpIds();
/// <summary>
/// Loads the full <see cref="PumpDefinition"/> for the pump with the given ID,
/// including its CAN parameter map and test list.
/// </summary>
PumpDefinition? LoadPump(string pumpId);
/// <summary>Persists a pump definition back to the database.</summary>
void SavePump(PumpDefinition pump);
// ── Clients ───────────────────────────────────────────────────────────────
/// <summary>Sorted client name → contact info dictionary.</summary>
SortedDictionary<string, string> Clients { get; }
/// <summary>Persists the client list to <c>clients.xml</c>.</summary>
void SaveClients();
// ── Pump status definitions ───────────────────────────────────────────────
/// <summary>
/// Loads the <see cref="PumpStatusDefinition"/> for the given status ID.
/// Definitions are cached after first load. Returns null if the ID is not found.
/// </summary>
PumpStatusDefinition? LoadPumpStatus(int statusId);
// ── Alarms ────────────────────────────────────────────────────────────────
/// <summary>Persists alarm definitions to <c>alarms.xml</c>.</summary>
void SaveAlarms();
// ── Sensors ───────────────────────────────────────────────────────────────
/// <summary>Saves updated sensor calibration data to <c>sensors.xml</c>.</summary>
void SaveSensors();
// ── Users ─────────────────────────────────────────────────────────────────
/// <summary>Validates a username/password pair against stored credentials.</summary>
bool ValidateUser(string username, string password);
/// <summary>Returns all stored usernames (passwords are never exposed).</summary>
IReadOnlyList<string> GetUsers();
/// <summary>Replaces all stored user credentials and persists them.</summary>
void UpdateUsers(Dictionary<string, string> users);
}
}