diff --git a/Aaru.Tui/Aaru.Tui.csproj b/Aaru.Tui/Aaru.Tui.csproj index d4e43fca4..e08179819 100644 --- a/Aaru.Tui/Aaru.Tui.csproj +++ b/Aaru.Tui/Aaru.Tui.csproj @@ -30,6 +30,10 @@ ImageHelpDialog.axaml Code + + HexViewHelpDialog.axaml + Code + diff --git a/Aaru.Tui/ViewModels/Dialogs/HexViewHelpDialogViewModel.cs b/Aaru.Tui/ViewModels/Dialogs/HexViewHelpDialogViewModel.cs new file mode 100644 index 000000000..46a9261f0 --- /dev/null +++ b/Aaru.Tui/ViewModels/Dialogs/HexViewHelpDialogViewModel.cs @@ -0,0 +1,24 @@ +using System.Windows.Input; +using CommunityToolkit.Mvvm.Input; +using Iciclecreek.Avalonia.WindowManager; + +namespace Aaru.Tui.ViewModels.Dialogs; + +public sealed class HexViewHelpDialogViewModel : ViewModelBase +{ + internal ManagedWindow _dialog = null!; + + + public HexViewHelpDialogViewModel(ManagedWindow dialog) + { + _dialog = dialog; + OkCommand = new RelayCommand(Ok); + } + + public ICommand OkCommand { get; } + + void Ok() + { + _dialog.Close(true); + } +} \ No newline at end of file diff --git a/Aaru.Tui/ViewModels/Windows/HexViewWindowViewModel.cs b/Aaru.Tui/ViewModels/Windows/HexViewWindowViewModel.cs index 174eb9c80..66dbe80a6 100644 --- a/Aaru.Tui/ViewModels/Windows/HexViewWindowViewModel.cs +++ b/Aaru.Tui/ViewModels/Windows/HexViewWindowViewModel.cs @@ -29,6 +29,7 @@ using System.Collections.ObjectModel; using System.Windows.Input; using Aaru.CommonTypes.Interfaces; using Aaru.Tui.ViewModels.Dialogs; +using Aaru.Tui.Views.Dialogs; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; @@ -61,6 +62,7 @@ public sealed partial class HexViewWindowViewModel : ViewModelBase NextSectorCommand = new RelayCommand(NextSector); PreviousSectorCommand = new RelayCommand(PreviousSector); GoToCommand = new AsyncRelayCommand(GoToAsync); + HelpCommand = new AsyncRelayCommand(HelpAsync); _parent = parent; _view = view; @@ -75,6 +77,20 @@ public sealed partial class HexViewWindowViewModel : ViewModelBase public ICommand NextSectorCommand { get; } public ICommand PreviousSectorCommand { get; } public ICommand GoToCommand { get; } + public ICommand HelpCommand { get; } + + Task HelpAsync() + { + var dialog = new HexViewHelpDialog + { + DataContext = new HexViewHelpDialogViewModel(null!) + }; + + // Set the dialog reference after creation + ((HexViewHelpDialogViewModel)dialog.DataContext!)._dialog = dialog; + + return dialog.ShowDialog(_view); + } async Task GoToAsync() { diff --git a/Aaru.Tui/Views/Dialogs/HexViewHelpDialog.axaml b/Aaru.Tui/Views/Dialogs/HexViewHelpDialog.axaml new file mode 100644 index 000000000..9e19cc108 --- /dev/null +++ b/Aaru.Tui/Views/Dialogs/HexViewHelpDialog.axaml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +