wpfOokiiDialogBox

(Hide table-of-contents)

Overview

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

CredentialDialog.png

( Show the code)

 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

TaskDialog.png

( Show the code)

 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)

TaskDialogWithCommandLinks.png

( Show the code)

ShowVistaOpenFileDialog

VistaOpenFileDialog.png

( Show the code)

 ShowVistaOpenFileDialog;dialog;⎕USING

 ⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'

 dialog←⎕NEW VistaOpenFileDialog

 dialog.Filter←'All files (*.*)|*.*'

 :If 1=dialog.ShowDialog ⍬
     'Selected file: ',dialog.FileName
 :Else
     'No path selected'
 :End

ShowVistaSaveFileDialog

VistaSaveFileDialog.png

( Show the code)

 ShowVistaSaveFileDialog;dialog;⎕USING

 ⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'

 dialog←⎕NEW VistaSaveFileDialog

 dialog.Filter←'Text files (*.txt)|*.txt|All files (*.*)|*.*'
 dialog.DefaultExt←'txt'

 :If 1=dialog.ShowDialog ⍬
     'Selected file: ',dialog.FileName
 :Else
     'No path selected'
 :End

ShowVistaFolderBrowserDialog

VistaFolderBrowserDialog.png

( Show the code)

 ShowVistaFolderBrowserDialog;dialog;⎕USING

 ⎕USING←'Ookii.Dialogs.Wpf,Ookii.Dialogs.Wpf.dll'

 dialog←⎕NEW VistaFolderBrowserDialog

 dialog.Description←'Please select a folder'
 dialog.UseDescriptionForTitle←1

 :If 1=dialog.ShowDialog ⍬
     'Selected path:',dialog.SelectedPath
 :Else
     'No path selected'
 :End

Version Information

Original author:

Pierre Gilbert

Responsible:

PierreGilbert

Email:

<apgil AT SPAMFREE videotron DOT ca>


See also: wpfDialogBox


CategoryDyalog - CategoryDyalogDotNet - CategoryDyalogWpfUtilities - CategoryDotNet


CategoryDyalogWpfUtilities

wpfOokiiDialogBox (last edited 2015-07-27 12:23:48 by PierreGilbert)