The aim here is to display a digital gauge in a window and have it show the current date/time - incrementing once a second


∇  xaml←DigitalGaugeXAML
⍝ XAML for the DigitalGauge 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:DigitalGauge Height="50" Width="500" Name="dg"'
 xaml,←⊂'            CharacterType="SegmentFourteen" HorizontalContentAlignment="Center"'
 xaml,←⊂'            >'
 xaml,←⊂'        </sfg:DigitalGauge>'
 xaml,←⊂'        <Button Name="btnStop" Content="Stop"/>'
 xaml,←⊂'    </StackPanel>'


∇ DigitalGauge;⎕IO;⎕ML;xaml;⎕USING
⍝ Simple DigitalGauge example
 ⎕IO ⎕ML←0 3
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncGauge')
 window_dg window_btnStop←{window.FindName⊂⍵}¨'dg' '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)

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

∇ DigitalGaugeIncrement w;⎕IO;⎕ML;ts;⎕USING
⍝ Increment pointer
 ⎕IO ⎕ML←0 3
 ts←⎕NEW DateTime(6↑⎕TS)
 window_dg.(CharacterCount Value)←{(≢⍵)⍵}⍕ts

∇ DigitalGaugeStop w;⎕IO;⎕ML
⍝ Stop the DigitalGauge 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.