Or cyclometer - aim is to display a counter that increments every second.


∇  xaml←RollingGaugeXAML
⍝ XAML for the RollingGauge example
 xaml,←⊂'    xmlns=""'
 xaml,←⊂'    xmlns:x=""'
 xaml,←⊂'    xmlns:sfg="clr-namespace:Syncfusion.Windows.Gauge;assembly=Syncfusion.Gauge.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" Name="gaugewindow">'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sfg:RollingGauge Name="rg" Height="50"'
 xaml,←⊂'            SegmentCount="4" Unit="Count:" UnitPosition="Start"'
 xaml,←⊂'            >'
 xaml,←⊂'        </sfg:RollingGauge>'
 xaml,←⊂'        <Button Name="btnStop" Content="Stop"/>'
 xaml,←⊂'    </StackPanel>'


∇ RollingGauge;⎕IO;⎕ML;xaml;⎕USING
⍝ Simple RollingGauge example
 ⎕IO ⎕ML←0 3
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncGauge')
 window_rg window_btnStop←{window.FindName⊂⍵}¨'rg' 'btnStop'
 ⎕USING←'System,mscorlib.dll' 'System.Windows.Threading,WindowsBase.dll' 'System.Windows.Media,presentationcore.dll'
 #.timer←⎕NEW DispatcherTimer
 #.timer.Interval←⎕NEW TimeSpan(0 0 1)

Notice here that for some reason it is necessary to offer Value in character form rather than number (see also the rigmarole in RollingGaugeIncrement).

The hocus-pocus to define and start the Timer should really hide away inside another function.

∇ RollingGaugeIncrement w;⎕IO;⎕ML;value
⍝ Increment RollingGauge
 ⎕IO ⎕ML←0 3

∇ RollingGaugeStop w;⎕IO;⎕ML
⍝ Stop the RollingGauge and close the window
 ⎕IO ⎕ML←0 3

Notice also the untidiness (in terms of global variables) which is endemic to WPF-based code, especially when using Show rather than ShowDialog.

The 'SyncGauge' argument to #.UTIL.LoadXAML has the effect of adding 'Syncfusion.Windows.Gauge,Syncfusion/4.5/Syncfusion.Gauge.WPF.dll' to the ⎕USING list of LoadXAML



Unresolved Issues

More control over appearance.