BusyIndicator


Aim is to display "progress" - updating by 10% every second and closing the indication at 100%.



XAML


∇  xaml←BusyIndicatorXAML
⍝ XAML for the BusyIndicator example
 xaml←⊂'<Window'
 xaml,←⊂'    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
 xaml,←⊂'    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
 xaml,←⊂'    xmlns:sftools="clr-namespace:Syncfusion.Windows.Tools.Controls;assembly=SyncFusion.Shared.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sftools:BusyIndicator Name="busy" >'
 xaml,←⊂'        </sftools:BusyIndicator>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>'


Code


∇ BusyIndicator(header description);⎕IO;⎕ML;xaml
⍝ Simple BusyIndicator example
 ⎕IO ⎕ML←0 3
 xaml←BusyIndicatorXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncTools')
 window_busy←#.window.FindName⊂'busy'
 window_busy.(Header LoadingDescription IsBusy ProgressValue)←header description 1 0
 ⎕USING←'System,mscorlib.dll' 'System.Windows.Threading,WindowsBase.dll' 'System.Windows.Media,presentationcore.dll'
 #.timer←⎕NEW DispatcherTimer
 #.timer.Interval←⎕NEW TimeSpan(0 0 1)
 #.timer.onTick←'BusyIndicatorIncrement'
 #.timer.Start
 #.window.Show


∇ BusyIndicatorIncrement w;⎕IO;⎕ML;ts;⎕USING
⍝ Increment BusyIndicator
 ⎕IO ⎕ML←0 3
 ⎕USING←,⊂'System'
 window_busy.ProgressValue+←10
 :If window_busy.ProgressValue=100
     #.timer.Stop
     #.window.Close
 :EndIf


The 'SyncTools' argument to #.UTIL.LoadXAML has the effect of adding

'Syncfusion.Windows.Shared,Syncfusion/4.5/Syncfusion.Shared.WPF.dll'
'SyncFusion.Windows.Tools.Controls,Syncfusion/4.5/Syncfusion.Tools.WPF.dll

 to the ⎕USING list of
LoadXAML

The Timer stuff would - in practice - sit somewhere else and probably be replaced by some more appropriate measure of progress.

Operation


     #.BusyIndicator.BusyIndicator 'I''m a busy little bee' 'Buzz-buzz-buzz...' 

Unresolved Issues


At present there's nothing particularly troubling/interesting me about this control...