Skip to content

Commit

Permalink
Added example for Finished event (#88) and fixed logic in OnCancelled…
Browse files Browse the repository at this point in the history
… event.
  • Loading branch information
dahall committed Oct 13, 2020
1 parent 2f483f3 commit b3276e3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/Library/WizardControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ public WizardControl()
[Category("Behavior"), Description("Occurs when the user clicks the Cancel button and allows for programmatic cancellation.")]
public event CancelEventHandler Cancelling;

/// <summary>
/// Occurs when the user clicks the Next/Finish button and the page is set to <see cref="WizardPage.IsFinishPage"/> or this is the
/// last page in the <see cref="Pages"/> collection.
/// </summary>
/// <summary>Occurs when the user clicks the Next/Finish button and the page is set to <see cref="WizardPage.IsFinishPage" /> or this is the
/// last page in the <see cref="Pages" /> collection.</summary>
/// <example>
/// <code title="Using Finished event to close form">public MyFormWizard()
/// {
/// InitializeComponent();
/// wizardControl.Finished += wizardControl_Finished;
/// }
///
/// private void wizardControl_Finished(object sender, EventArgs e)
/// {
/// Close();
/// }</code>
/// </example>
[Category("Behavior"), Description("Occurs when the user clicks the Next/Finish button on last page.")]
public event EventHandler Finished;

Expand Down Expand Up @@ -312,7 +322,7 @@ protected virtual void OnCancelling(CancelEventArgs arg)
{
Cancelling?.Invoke(this, arg);

if (arg.Cancel && !this.IsDesignMode()) CloseForm(DialogResult.Cancel);
if (!arg.Cancel && !this.IsDesignMode()) CloseForm(DialogResult.Cancel);
}

/// <summary>Raises the <see cref="E:System.Windows.Forms.Control.ControlAdded"/> event.</summary>
Expand Down

0 comments on commit b3276e3

Please sign in to comment.