Interface IWizardDialog
Defines methods to show a dialog containing a Wizard.
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
public interface IWizardDialog
Examples
This example illustrates how to import the WizardDialog using MEF.
internal class MyClass
{
private readonly IWizardDialog wizardDialog;
[ImportingConstructor]
public MyClass(IWizardDialog wizardDialog)
{
this.wizardDialog = wizardDialog;
}
}
This example illustrates how to implement a IWizardDialogContext that can be used as the DialogContext parameter. If the ShowHelpCommand command is set to null, no help button is shown in the dialog. The CloseDialog event can be invoked at any time, to force the dialog to be closed.
internal class MyWizardViewModel : ViewModelBase, IWizardDialogContext
{
public MyWizardViewModel()
{
ShowHelpCommand = new DelegateCommand(ExecuteShowHelp);
}
/// <summary>
/// Must be invoked by the implementation to force a close of the <see cref="IWizardDialog" />.
/// </summary>
public event EventHandler CloseDialog;
/// <summary>
/// Gets the command to show the help of the <see cref="IWizardDialog" />.
/// </summary>
/// <remarks>Null indicates that no help is available.</remarks>
public ICommand ShowHelpCommand { get; }
private void ExecuteShowHelp()
{
// Show help content.
}
private void OnCloseDialog()
{
var handler = CloseDialog;
if (handler != null)
{
handler(this, EventArgs.Empty);
}
}
}
This example illustrates how to implement a IWizardDialogContext<T> that can be used as the DialogContext parameter. The type parameter of the IWizardDialogContext<T> represents the return System.Type of the Show<TResult>(WizardDialogArgs) method.
internal class MyWizardViewModel : ViewModelBase, IWizardDialogContext<String>
{
/// <summary>
/// Must be invoked by the implementation to force a close of the <see cref="IWizardDialog" />.
/// </summary>
public event EventHandler CloseDialog;
/// <summary>
/// The result of the <see cref="IWizardDialog.Show{TResult}" /> method.
/// </summary>
public String Result { get; set; }
/// <summary>
/// Gets the command to show the help of the <see cref="IWizardDialog" />.
/// </summary>
/// <remarks>Null indicates that no help is available.</remarks>
public ICommand ShowHelpCommand { get; private set; }
private void OnCloseDialog()
{
var handler = CloseDialog;
if (handler != null)
{
Result = "Dialog has been canceled.";
handler(this, EventArgs.Empty);
}
}
}
This example illustrates how to implement a Wizard that can be used as the DialogView parameter.
<SAF:Wizard>
<SAF:WizardPage>
<TextBlock Text="Page 1" />
</SAF:WizardPage>
<SAF:WizardPage>
<TextBlock Text="Page 2" />
</SAF:WizardPage>
</SAF:Wizard>
This example illustrates how to show a WizardDialog.
var wizardDialogArgs = new WizardDialogArgs("My Wizard Dialog", myWizard, myWizardViewModel);
wizardDialog.Show(wizardDialogArgs);
This example illustrates how to show a WizardDialog that returns a result of type System.String. The DialogContext must implement IWizardDialogContext<T>.
var wizardDialogArgs = new WizardDialogArgs("My Wizard Dialog", myWizard, myWizardViewModel);
var result = wizardDialog.Show<String>(wizardDialogArgs);
Methods
View SourceShow(WizardDialogArgs)
Shows a dialog with the wizard defined in the wizardDialogArgs
.
Declaration
void Show(WizardDialogArgs wizardDialogArgs)
Parameters
Type | Name | Description |
---|---|---|
WizardDialogArgs | wizardDialogArgs | The WizardDialogArgs. |
Remarks
See WizardDialog for remarks and code examples.
Show<TResult>(WizardDialogArgs)
Shows a dialog with the wizard defined in the wizardDialogArgs
.
Declaration
TResult Show<TResult>(WizardDialogArgs wizardDialogArgs)
Parameters
Type | Name | Description |
---|---|---|
WizardDialogArgs | wizardDialogArgs | The WizardDialogArgs. |
Returns
Type | Description |
---|---|
TResult | The result. |
Type Parameters
Name | Description |
---|---|
TResult | the System.Type of the result. |
Remarks
See WizardDialog for remarks and code examples.