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<int?> support

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-22 00:52:31 +00:00
parent 78f4a08322
commit e43409f45e
2 changed files with 29 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);POST_4148</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Terminal.Gui\Terminal.Gui.csproj" />

View File

@@ -7,9 +7,17 @@ namespace Terminal.Gui.Views;
/// navigate forward and backward through the Wizard.
/// </summary>
/// <remarks>
/// The Wizard can be displayed either as a modal (pop-up) <see cref="Window"/> (like <see cref="Dialog"/>) or as
/// an embedded <see cref="View"/>. By default, <see cref="Wizard.Modal"/> is <c>true</c>. In this case launch the
/// Wizard with <c>Application.Run(wizard)</c>. See <see cref="Wizard.Modal"/> for more details.
/// <para>
/// The Wizard can be displayed either as a modal (pop-up) <see cref="Window"/> (like <see cref="Dialog"/>) or as
/// an embedded <see cref="View"/>. By default, <see cref="Wizard.Modal"/> is <c>true</c>. In this case launch the
/// Wizard with <c>Application.Run(wizard)</c>. See <see cref="Wizard.Modal"/> for more details.
/// </para>
/// <para>
/// <b>Phase 2:</b> Since <see cref="Wizard"/> inherits from <see cref="Dialog"/>, which implements
/// <see cref="IRunnable{TResult}"/> with <c>int?</c> result type, the wizard automatically provides result
/// tracking through <see cref="Dialog.Result"/>. Use the <see cref="WasFinished"/> property to check if the
/// wizard was completed or canceled.
/// </para>
/// </remarks>
/// <example>
/// <code>
@@ -100,6 +108,23 @@ public class Wizard : Dialog
/// <remarks>Use the <see cref="MovingBack"></see> event to be notified when the user attempts to go back.</remarks>
public Button BackButton { get; }
/// <summary>
/// Gets whether the wizard was completed (the Finish button was pressed and <see cref="Finished"/> event fired).
/// </summary>
/// <remarks>
/// <para>
/// This is a convenience property that checks if <see cref="Dialog.Result"/> indicates the wizard was
/// finished rather than canceled. Since <see cref="Wizard"/> inherits from <see cref="Dialog"/> which
/// implements <see cref="IRunnable{TResult}"/> with <c>int?</c> result type, the <see cref="Dialog.Result"/>
/// property contains the button index. The Finish button is added as the last button.
/// </para>
/// <para>
/// Returns <see langword="true"/> if <see cref="Dialog.Result"/> is not <see langword="null"/> and equals
/// the index of the Next/Finish button, <see langword="false"/> otherwise (canceled or Back button pressed).
/// </para>
/// </remarks>
public bool WasFinished => Result is { } && _finishedPressed;
/// <summary>Gets or sets the currently active <see cref="WizardStep"/>.</summary>
public WizardStep? CurrentStep
{