The following Dyalog functions are using the assembly Ooki.Dialogs.Wpf.dll available for download (no charge) at http://www.ookii.org/Software/Dialogs/. The assembly is used to generate the following six (6) dialog boxes (please refer to the downloaded information for more explication on the assembly):
ShowCredentialDialog;dialog;⎕USING
⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'
dialog←⎕NEW CredentialDialog
dialog.MainInstruction←'Please enter your username and password.'
dialog.Content←'Since this is a sampe the credentials won''t be used for anything, so you can enter anything you like.'
dialog.ShowSaveCheckBox←1
dialog.ShowUIForSavedCredentials←1
⍝ The target is the key under which the credentials will be stored.
⍝ It is recommended to set the target to something following the"Company_Application_Server"pattern.
⍝ Targets are per user,not per application,so using such a pattern will ensure uniqueness.
dialog.Target←'Ookii_DialogsWpfSample_www.example.com'
:If 1=dialog.ShowDialog ⍬
'User Name: ',dialog.Credentials.UserName
'Password: ',dialog.Credentials.Password
dialog.ConfirmCredentials 1
:Else
'Cancel Button was pressed'
:End
⍝ Later the saved credential can be retreived by doing:
⍝ credential←dialog.RetrieveCredential(⊂'Ookii_DialogsWpfSample_www.example.com')
⍝ credential.UserName
⍝ credential.Password
ShowTaskDialog;button;cancelButton;customButton;dialog;okButton;⎕USING
⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'
dialog←⎕NEW TaskDialog
dialog.WindowTitle←'Task dialog sample'
dialog.MainInstruction←'This is an example task dialog.'
dialog.Content←'Task dialogs are a more flexible type of message box. Among other things, task dialogs support custom buttons, command links, scroll bars, expandable sections, radio buttons, a check box (useful for e.g. "don''t show this again"),custom icons,and a footer.Some of those things are demonstrated here.'
dialog.ExpandedInformation←'Ookii.org''s Task Dialog doesn''t just provide a wrapper for the native Task Dialog API; it is designed to provide a programming interface that is natural to .Net developers.'
dialog.Footer←'Task Dialogs support footers and can even include <a href="http://www.ookii.org">hyperlinks</a>.'
dialog.FooterIcon←TaskDialogIcon.Information
dialog.EnableHyperlinks←1
customButton←⎕NEW TaskDialogButton(⊂'A custom button')
okButton←⎕NEW TaskDialogButton(ButtonType.Ok)
cancelButton←⎕NEW TaskDialogButton(ButtonType.Cancel)
dialog.Buttons.Add¨customButton okButton cancelButton
dialog.onHyperlinkClicked←⎕OR'TaskDialog_HyperLinkClicked'
button←dialog.ShowDialog ⍬
:If customButton=button
'Custom Button was Clicked'
:ElseIf okButton=button
'OK Button was Clicked'
:Else
'Cancel Button was Clicked'
:End
TaskDialog_HyperLinkClicked(sender event);⎕USING
⍝ Subroutine used by ShowTaskDialog to show the hyperlink
⎕USING←',system.dll'
{}System.Diagnostics.Process.Start(⊂event.Href)
ShowTaskDialogWithCommandLinks;button;cancelButton;dialog;elevatedButton;otherButton;⎕USING
⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'
dialog←⎕NEW TaskDialog
dialog.WindowTitle←'Task dialog sample'
dialog.MainInstruction←'This is a sample task dialog with command links.'
dialog.Content←'Besides regular buttons, task dialogs also support command links. Only custom buttons are shown as command links; standard buttons remain regular buttons.'
dialog.ButtonStyle←TaskDialogButtonStyle.CommandLinks
elevatedButton←⎕NEW TaskDialogButton(⊂'An action requiring elevation')
elevatedButton.CommandLinkNote←'Both regular buttons and command links can show the shield icon to indicate that the action they perform requires elevation. It is up to the application to actually perform the elevation.'
elevatedButton.ElevationRequired←1
otherButton←⎕NEW TaskDialogButton(⊂'Some other action')
cancelButton←⎕NEW TaskDialogButton(ButtonType.Cancel)
dialog.Buttons.Add¨elevatedButton otherButton cancelButton
button←dialog.ShowDialog ⍬
:If elevatedButton=button
'Elevated Button was Clicked'
:ElseIf otherButton=button
'Other Button was Clicked'
:Else
'Cancel Button was Clicked'
:End