From 1d2759e00f5fc96ca7733f33694cf74a74903c54 Mon Sep 17 00:00:00 2001 From: Patchzy <64382339+patchzyy@users.noreply.github.com> Date: Fri, 13 Feb 2026 22:52:21 +0100 Subject: [PATCH] Update HomePage.axaml.cs --- WheelWizard/Views/Pages/HomePage.axaml.cs | 48 +++++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/WheelWizard/Views/Pages/HomePage.axaml.cs b/WheelWizard/Views/Pages/HomePage.axaml.cs index 674c1135..ca54024a 100644 --- a/WheelWizard/Views/Pages/HomePage.axaml.cs +++ b/WheelWizard/Views/Pages/HomePage.axaml.cs @@ -31,25 +31,39 @@ public partial class HomePage : UserControlBase ]; private WheelWizardStatus _status; - private MainButtonState currentButtonState => buttonStates[_status]; + private MainButtonState currentButtonState => GetButtonState(_status); - private static Dictionary buttonStates = new() - { - { WheelWizardStatus.Loading, new(Common.State_Loading, Button.ButtonsVariantType.Default, "Spinner", null, false) }, - { WheelWizardStatus.NoServer, new(Common.State_NoServer, Button.ButtonsVariantType.Danger, "RoadError", null, true) }, - { - WheelWizardStatus.NoServerButInstalled, - new(Common.Action_PlayOffline, Button.ButtonsVariantType.Warning, "Play", LaunchGame, true) - }, - { WheelWizardStatus.NoDolphin, new("Dolphin not setup", Button.ButtonsVariantType.Warning, "Settings", NavigateToSettings, false) }, + private static MainButtonState GetButtonState(WheelWizardStatus status) => + status switch { - WheelWizardStatus.ConfigNotFinished, - new(Common.State_ConfigNotFinished, Button.ButtonsVariantType.Warning, "Settings", NavigateToSettings, true) - }, - { WheelWizardStatus.NotInstalled, new(Common.Action_Install, Button.ButtonsVariantType.Warning, "Download", Download, true) }, - { WheelWizardStatus.OutOfDate, new(Common.Action_Update, Button.ButtonsVariantType.Warning, "Download", Update, true) }, - { WheelWizardStatus.Ready, new(Common.Action_Play, Button.ButtonsVariantType.Primary, "Play", LaunchGame, true) }, - }; + WheelWizardStatus.Loading => new(Common.State_Loading, Button.ButtonsVariantType.Default, "Spinner", null, false), + WheelWizardStatus.NoServer => new(Common.State_NoServer, Button.ButtonsVariantType.Danger, "RoadError", null, true), + WheelWizardStatus.NoServerButInstalled => new( + Common.Action_PlayOffline, + Button.ButtonsVariantType.Warning, + "Play", + LaunchGame, + true + ), + WheelWizardStatus.NoDolphin => new( + "Dolphin not setup", + Button.ButtonsVariantType.Warning, + "Settings", + NavigateToSettings, + false + ), + WheelWizardStatus.ConfigNotFinished => new( + Common.State_ConfigNotFinished, + Button.ButtonsVariantType.Warning, + "Settings", + NavigateToSettings, + true + ), + WheelWizardStatus.NotInstalled => new(Common.Action_Install, Button.ButtonsVariantType.Warning, "Download", Download, true), + WheelWizardStatus.OutOfDate => new(Common.Action_Update, Button.ButtonsVariantType.Warning, "Download", Update, true), + WheelWizardStatus.Ready => new(Common.Action_Play, Button.ButtonsVariantType.Primary, "Play", LaunchGame, true), + _ => new(Common.State_Loading, Button.ButtonsVariantType.Default, "Spinner", null, false), + }; public HomePage() {