From 209b9cca461a3416f6fbd050854a6307bed9cd4f Mon Sep 17 00:00:00 2001 From: Sascha Haase Date: Wed, 3 Jun 2026 16:44:24 +0200 Subject: [PATCH] fix(ui): enable Restore button when a snapshot is selected The "Restore selected snapshot" button bound to RestoreCommand stayed permanently disabled: its CanExecute is `SelectedBackup is not null`, but SelectedBackup was a plain auto-property raising no change notification, and AsyncRelayCommand does not hook CommandManager.RequerySuggested. WPF therefore evaluated CanExecute once at bind time (null -> disabled) and never re-queried on row selection. Make SelectedBackup a notifying property that raises RestoreCommand CanExecuteChanged, mirroring the SelectedTarget fix from d12cd2b that was not applied to the backup selection. "Restore from file..." was unaffected (no canExecute predicate), which is why only the primary restore path appeared broken. Reported by Marga Busqui (Penelope CAD). Co-Authored-By: Claude Opus 4.8 --- .../Ui/ViewModels/MainViewModel.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ClaudePortable.App/Ui/ViewModels/MainViewModel.cs b/src/ClaudePortable.App/Ui/ViewModels/MainViewModel.cs index ec16b10..0b8ddfe 100644 --- a/src/ClaudePortable.App/Ui/ViewModels/MainViewModel.cs +++ b/src/ClaudePortable.App/Ui/ViewModels/MainViewModel.cs @@ -140,7 +140,19 @@ public TargetEntry? SelectedTarget } } - public BackupEntry? SelectedBackup { get; set; } + private BackupEntry? _selectedBackup; + + public BackupEntry? SelectedBackup + { + get => _selectedBackup; + set + { + if (SetField(ref _selectedBackup, value)) + { + RestoreCommand?.RaiseCanExecuteChanged(); + } + } + } private string _postRestoreChecklistPath = string.Empty;