From 86245dae8102938f4b1ba05f978f3cce347a1a5e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 30 Jun 2026 08:10:09 +0100 Subject: [PATCH] Fix machine detail sub-item navigation --- .../Presentation/Models/GpuDisplayItem.cs | 3 +- .../Models/ProcessorDisplayItem.cs | 3 +- .../Models/SoundSynthesizerDisplayItem.cs | 3 +- .../ViewModels/MachineViewViewModel.cs | 54 +++++++++ .../Presentation/Views/MachineViewPage.xaml | 106 +++++++++++------- 5 files changed, 125 insertions(+), 44 deletions(-) diff --git a/Marechai.App/Presentation/Models/GpuDisplayItem.cs b/Marechai.App/Presentation/Models/GpuDisplayItem.cs index aa32c6bd..b96b310b 100644 --- a/Marechai.App/Presentation/Models/GpuDisplayItem.cs +++ b/Marechai.App/Presentation/Models/GpuDisplayItem.cs @@ -5,7 +5,8 @@ namespace Marechai.App.Presentation.Models; /// public class GpuDisplayItem { + public int Id { get; set; } public string DisplayName { get; set; } = string.Empty; public string Manufacturer { get; set; } = string.Empty; public bool HasManufacturer { get; set; } -} \ No newline at end of file +} diff --git a/Marechai.App/Presentation/Models/ProcessorDisplayItem.cs b/Marechai.App/Presentation/Models/ProcessorDisplayItem.cs index dc831b2f..e16beab3 100644 --- a/Marechai.App/Presentation/Models/ProcessorDisplayItem.cs +++ b/Marechai.App/Presentation/Models/ProcessorDisplayItem.cs @@ -5,8 +5,9 @@ namespace Marechai.App.Presentation.Models; /// public class ProcessorDisplayItem { + public int Id { get; set; } public string DisplayName { get; set; } = string.Empty; public string Manufacturer { get; set; } = string.Empty; public bool HasDetails { get; set; } public string DetailsText { get; set; } = string.Empty; -} \ No newline at end of file +} diff --git a/Marechai.App/Presentation/Models/SoundSynthesizerDisplayItem.cs b/Marechai.App/Presentation/Models/SoundSynthesizerDisplayItem.cs index 881edcef..de7dbff2 100644 --- a/Marechai.App/Presentation/Models/SoundSynthesizerDisplayItem.cs +++ b/Marechai.App/Presentation/Models/SoundSynthesizerDisplayItem.cs @@ -5,7 +5,8 @@ namespace Marechai.App.Presentation.Models; /// public class SoundSynthesizerDisplayItem { + public int Id { get; set; } public string DisplayName { get; set; } = string.Empty; public bool HasDetails { get; set; } public string DetailsText { get; set; } = string.Empty; -} \ No newline at end of file +} diff --git a/Marechai.App/Presentation/ViewModels/MachineViewViewModel.cs b/Marechai.App/Presentation/ViewModels/MachineViewViewModel.cs index 3fd8be6b..85b6842c 100644 --- a/Marechai.App/Presentation/ViewModels/MachineViewViewModel.cs +++ b/Marechai.App/Presentation/ViewModels/MachineViewViewModel.cs @@ -315,6 +315,57 @@ public partial class MachineViewViewModel : ObservableObject, IRegionAware return Task.CompletedTask; } + [RelayCommand] + public Task NavigateToProcessor(ProcessorDisplayItem? processor) + { + if(processor is null || processor.Id <= 0) return Task.CompletedTask; + + var parameters = new NavigationParameters + { + { NavParamKeys.ProcessorId, processor.Id }, + { NavParamKeys.MachineId, _currentMachineId }, + { NavParamKeys.NavigationSource, nameof(MachineViewViewModel) } + }; + + _regionManager.RequestNavigate(RegionNames.Content, nameof(ProcessorDetailPage), parameters); + + return Task.CompletedTask; + } + + [RelayCommand] + public Task NavigateToGpu(GpuDisplayItem? gpu) + { + if(gpu is null || gpu.Id <= 0) return Task.CompletedTask; + + var parameters = new NavigationParameters + { + { NavParamKeys.GpuId, gpu.Id }, + { NavParamKeys.MachineId, _currentMachineId }, + { NavParamKeys.NavigationSource, nameof(MachineViewViewModel) } + }; + + _regionManager.RequestNavigate(RegionNames.Content, nameof(GpuDetailPage), parameters); + + return Task.CompletedTask; + } + + [RelayCommand] + public Task NavigateToSoundSynth(SoundSynthesizerDisplayItem? soundSynth) + { + if(soundSynth is null || soundSynth.Id <= 0) return Task.CompletedTask; + + var parameters = new NavigationParameters + { + { NavParamKeys.SoundSynthId, soundSynth.Id }, + { NavParamKeys.MachineId, _currentMachineId }, + { NavParamKeys.NavigationSource, nameof(MachineViewViewModel) } + }; + + _regionManager.RequestNavigate(RegionNames.Content, nameof(SoundSynthDetailPage), parameters); + + return Task.CompletedTask; + } + [RelayCommand] public async Task OpenVideo(MachineVideoDisplayItem? video) { @@ -424,6 +475,7 @@ public partial class MachineViewViewModel : ObservableObject, IRegionAware Processors.Add(new ProcessorDisplayItem { + Id = processor.Id ?? 0, DisplayName = processor.Name ?? string.Empty, Manufacturer = processor.Company ?? string.Empty, HasDetails = details.Count > 0, @@ -464,6 +516,7 @@ public partial class MachineViewViewModel : ObservableObject, IRegionAware { Gpus.Add(new GpuDisplayItem { + Id = gpu.Id ?? 0, DisplayName = LocalizeSpecialGpuName(gpu.Name), Manufacturer = gpu.Company ?? string.Empty, HasManufacturer = !string.IsNullOrEmpty(gpu.Company) @@ -483,6 +536,7 @@ public partial class MachineViewViewModel : ObservableObject, IRegionAware SoundSynthesizers.Add(new SoundSynthesizerDisplayItem { + Id = synth.Id ?? 0, DisplayName = LocalizeSpecialSoundSynthName(synth.Name), HasDetails = details.Count > 0, DetailsText = string.Join(", ", details) diff --git a/Marechai.App/Presentation/Views/MachineViewPage.xaml b/Marechai.App/Presentation/Views/MachineViewPage.xaml index 0126df23..49301a14 100644 --- a/Marechai.App/Presentation/Views/MachineViewPage.xaml +++ b/Marechai.App/Presentation/Views/MachineViewPage.xaml @@ -204,22 +204,30 @@ - - - - - - - + @@ -277,18 +285,26 @@ - - - - - - + @@ -312,19 +328,27 @@ - - - - - - +