[TUI] Add Main Help dialog with F1 shortcut and Ok command

This commit is contained in:
2025-10-16 21:14:27 +01:00
parent e4be93ee5c
commit 8aca911c3d
5 changed files with 125 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
ExitCommand = new RelayCommand(Exit);
SectorViewCommand = new RelayCommand(SectorView);
GoToPathCommand = new AsyncRelayCommand(GoToPathAsync);
HelpCommand = new AsyncRelayCommand(HelpAsync);
OpenSelectedFileCommand = new RelayCommand(OpenSelectedFile, CanOpenSelectedFile);
InformationalVersion =
@@ -107,6 +108,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
public ICommand ExitCommand { get; }
public ICommand SectorViewCommand { get; }
public ICommand GoToPathCommand { get; }
public ICommand HelpCommand { get; }
public bool IsFileInfoAvailable => SelectedFile?.FileInfo != null;
public bool SelectedFileIsNotDirectory => SelectedFile?.IsDirectory == false;
public long? SelectedFileLength => SelectedFile?.IsDirectory == false ? SelectedFile?.FileInfo?.Length : 0;
@@ -118,6 +120,19 @@ public sealed partial class MainWindowViewModel : ViewModelBase
public string? SelectedFileInformation => SelectedFile?.Information;
Task HelpAsync()
{
var dialog = new MainHelpDialog
{
DataContext = new MainHelpDialogViewModel(null!)
};
// Set the dialog reference after creation
((MainHelpDialogViewModel)dialog.DataContext!)._dialog = dialog;
return dialog.ShowDialog(_view);
}
async Task GoToPathAsync()
{
var dialog = new GoToPathDialog