Shows a page in a task dialog.
Class: SftTaskDialog
Namespace: Softelvdm.SftStyleNET
Assembly: Softelvdm.SftStyleNET
public static SftTaskDialogButton ShowDialog( SftTaskDialogPage page, SftTaskDialogStartupLocation startupLocation ); public static SftTaskDialogButton ShowDialog( IWin32Window owner, SftTaskDialogPage page, SftTaskDialogStartupLocation startupLocation ); public static SftTaskDialogButton ShowDialog( IntPtr hwndOwner, SftTaskDialogPage page, SftTaskDialogStartupLocation startupLocation );
Public Shared Function ShowDialog(
ByVal page As SftTaskDialogPage,
ByVal startupLocation As SftTaskDialogStartupLocation
) As SftTaskDialogButton
Public Shared Function ShowDialog(
ByVal owner As IWin32Window,
ByVal page As SftTaskDialogPage,
ByVal startupLocation As SftTaskDialogStartupLocation
) As SftTaskDialogButton
Public Shared Function ShowDialog(
ByVal hwndOwner As IntPtr,
ByVal page As SftTaskDialogPage,
ByVal startupLocation As SftTaskDialogStartupLocation
) As SftTaskDialogButtonpage
The page to show; null throws an ArgumentNullException.
startupLocation
Where the dialog appears. The default is SftTaskDialogStartupLocation.CenterOwner.
owner
The window that owns the dialog.
hwndOwner
The handle of the window that owns the dialog, or IntPtr.Zero for none.
The button that closed the dialog, or SftTaskDialogButton.Cancel when it was closed with Esc, the close box or Close.
Shows a page in a task dialog.
This overload shows the dialog without an owner: the other windows of the application stay enabled while it is shown, and it has a taskbar button. The method throws an InvalidOperationException when the page is already shown, when one of its elements or collections belongs to a shown page, when more than one of its radio buttons is checked, when a custom button or radio button has no text, and when SftTaskDialogPage.DefaultButton is not in its SftTaskDialogPage.Buttons collection.
The method throws an InvalidOperationException in the cases ShowDialog(SftTaskDialogPage, SftTaskDialogStartupLocation) describes.
Icon = SftTaskDialogIcon.Warning,
Verification = new SftTaskDialogVerificationCheckBox("&Do not ask again"),
Expander = new SftTaskDialogExpander("Order 1042, Order 1044 and Order 1045 have changes that are not saved."),
Footnote = new SftTaskDialogFootnote("Drafts are kept for 30 days."),
};
page.Buttons.Add(new SftTaskDialogCommandLinkButton("&Save the orders", "They are saved as drafts and can be completed later."));
page.Buttons.Add(new SftTaskDialogCommandLinkButton("D&iscard the orders", "The changes are lost."));
page.Buttons.Add(SftTaskDialogButton.Cancel);
SftTaskDialogButton clicked = SftTaskDialog.ShowDialog(this, page);
labelResult.Text = "Task dialog: " + (clicked == null ? "closed" : clicked.Text.Replace("&", "")) + (page.Verification.Checked ? ", do not ask again" : "");
}
private void buttonColorDialog_Click(object sender, EventArgs e) {
sftColorDialog1.Color = panelColor.BackColor;
if (sftColorDialog1.ShowDialog(this) == DialogResult.OK) {
panelColor.BackColor = sftColorDialog1.Color;
page.Heading = "What do you want to do with the 3 unsaved orders?"
page.Icon = SftTaskDialogIcon.Warning
page.Verification = New SftTaskDialogVerificationCheckBox("&Do not ask again")
page.Expander = New SftTaskDialogExpander("Order 1042, Order 1044 and Order 1045 have changes that are not saved.")
page.Footnote = New SftTaskDialogFootnote("Drafts are kept for 30 days.")
page.Buttons.Add(New SftTaskDialogCommandLinkButton("&Save the orders", "They are saved as drafts and can be completed later."))
page.Buttons.Add(New SftTaskDialogCommandLinkButton("D&iscard the orders", "The changes are lost."))
page.Buttons.Add(SftTaskDialogButton.Cancel)
Dim clicked As SftTaskDialogButton = SftTaskDialog.ShowDialog(Me, page)
Dim text As String = "closed"
If clicked IsNot Nothing Then
text = clicked.Text.Replace("&", "")
End If
If page.Verification.Checked Then
text += ", do not ask again"
End IfSee Also SftTaskDialog Class | Classes | SftStyle/NET 3.0