From e43409f45e902c661e1fe2ea0186bb014e96ba8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 00:52:31 +0000 Subject: [PATCH] Implement steps 4-6: Update Wizard and enable FluentExample POST_4148 - Added WasFinished convenience property to Wizard to check completion status - Updated Wizard documentation to explain IRunnable integration - Enabled POST_4148 in FluentExample to demonstrate fluent API with automatic disposal - Wizard inherits from Dialog so it automatically has IRunnable support Co-authored-by: tig <585482+tig@users.noreply.github.com> --- Examples/FluentExample/FluentExample.csproj | 1 + Terminal.Gui/Views/Wizard/Wizard.cs | 31 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Examples/FluentExample/FluentExample.csproj b/Examples/FluentExample/FluentExample.csproj index 2086af6ed..a95c7a025 100644 --- a/Examples/FluentExample/FluentExample.csproj +++ b/Examples/FluentExample/FluentExample.csproj @@ -4,6 +4,7 @@ net8.0 preview enable + $(DefineConstants);POST_4148 diff --git a/Terminal.Gui/Views/Wizard/Wizard.cs b/Terminal.Gui/Views/Wizard/Wizard.cs index 50b21c7ed..8e2b3d28f 100644 --- a/Terminal.Gui/Views/Wizard/Wizard.cs +++ b/Terminal.Gui/Views/Wizard/Wizard.cs @@ -7,9 +7,17 @@ namespace Terminal.Gui.Views; /// navigate forward and backward through the Wizard. /// /// -/// The Wizard can be displayed either as a modal (pop-up) (like ) or as -/// an embedded . By default, is true. In this case launch the -/// Wizard with Application.Run(wizard). See for more details. +/// +/// The Wizard can be displayed either as a modal (pop-up) (like ) or as +/// an embedded . By default, is true. In this case launch the +/// Wizard with Application.Run(wizard). See for more details. +/// +/// +/// Phase 2: Since inherits from , which implements +/// with int? result type, the wizard automatically provides result +/// tracking through . Use the property to check if the +/// wizard was completed or canceled. +/// /// /// /// @@ -100,6 +108,23 @@ public class Wizard : Dialog /// Use the event to be notified when the user attempts to go back. public Button BackButton { get; } + /// + /// Gets whether the wizard was completed (the Finish button was pressed and event fired). + /// + /// + /// + /// This is a convenience property that checks if indicates the wizard was + /// finished rather than canceled. Since inherits from which + /// implements with int? result type, the + /// property contains the button index. The Finish button is added as the last button. + /// + /// + /// Returns if is not and equals + /// the index of the Next/Finish button, otherwise (canceled or Back button pressed). + /// + /// + public bool WasFinished => Result is { } && _finishedPressed; + /// Gets or sets the currently active . public WizardStep? CurrentStep {