Schalter, Zeitfenster und Handoff-Prozent lagen im Usage-Monitor und mussten in SettingsModalViewModel nur load->save durchgeschleift werden, damit ein Settings-Speichern sie nicht zurueckwirft. Jetzt gehoeren sie dem General-Tab, der Monitor ist wieder nur Anzeige + Threshold-Drag, und "Jetzt aktualisieren" sitzt als Icon in der Titelleiste (neuer ModalShell.HeaderActions-Slot).
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using Avalonia.Interactivity;
|
|
using ClaudeDo.Ui.ViewModels.Modals;
|
|
|
|
namespace ClaudeDo.Ui.Views.Modals;
|
|
|
|
public partial class UsageMonitorModalView : Window
|
|
{
|
|
public UsageMonitorModalView() => InitializeComponent();
|
|
|
|
/// <summary>
|
|
/// Persists a stage typed into a gauge's legend box. `NumericUpDown` has no commit command, so
|
|
/// the box's <c>Tag</c> names the stage and the row's matching command does the clamp + save.
|
|
/// </summary>
|
|
private void OnStageBoxCommit(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is not Control { Tag: string stage, DataContext: UsageGaugeRowViewModel row }) return;
|
|
|
|
var command = stage switch
|
|
{
|
|
"soft" => row.CommitSoftCommand,
|
|
"hard" => row.CommitHardCommand,
|
|
_ => row.CommitGateCommand,
|
|
};
|
|
|
|
if (command.CanExecute(null)) command.Execute(null);
|
|
}
|
|
|
|
private void OnStageBoxKeyDown(object? sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key != Key.Enter) return;
|
|
OnStageBoxCommit(sender, e);
|
|
e.Handled = true;
|
|
}
|
|
}
|