From 5830f7efb3055259ebf3ddb1be049d2f67991d53 Mon Sep 17 00:00:00 2001 From: jlewin Date: Thu, 9 May 2019 17:26:59 -0700 Subject: [PATCH] Simplify with tuples --- MatterControlLib/SetupWizard/StagedSetupWindow.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/MatterControlLib/SetupWizard/StagedSetupWindow.cs b/MatterControlLib/SetupWizard/StagedSetupWindow.cs index 3a73128e1..a4eafb524 100644 --- a/MatterControlLib/SetupWizard/StagedSetupWindow.cs +++ b/MatterControlLib/SetupWizard/StagedSetupWindow.cs @@ -62,15 +62,13 @@ namespace MatterHackers.MatterControl } // Ensure all or only the active stage is enabled - foreach (var kvp in rowsByStage) + foreach (var (stage, widget) in rowsByStage.Select(x => (x.Key, x.Value))) // project to tuple - deconstruct to named items { - ISetupWizard stage = kvp.Key; bool isActiveStage = stage == value; bool noActiveStage = value == null; // Enable GuiWidget when no stage is active or when the current stage is active and enabled - var widget = kvp.Value; - widget.Enabled = noActiveStage || isActiveStage; + widget.Enabled = stage.Enabled && (noActiveStage || isActiveStage); } // Shutdown the active Wizard