Aim is to indicate the value of a random variable updating every second.


∇  xaml←LinearGaugeXAML
⍝ XAML for the LinearGauge 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:LinearGauge Height="100">'
 xaml,←⊂'           <sfg:LinearGauge.Scales>'
 xaml,←⊂'               <sfg:LinearScale'
 xaml,←⊂'                   Height="100" BorderWidth="3" '
 xaml,←⊂'                   Maximum="10" Minimum="0" MajorIntervalValue="1"'
 xaml,←⊂'                   BackgroundBrush="Transparent" BorderBrush="Transparent" '
 xaml,←⊂'                   ScaleDirection="CounterClockwise" ScaleBarSize="15">'
 xaml,←⊂'                   <sfg:LinearScale.Ticks>'
 xaml,←⊂'                       <sfg:LinearMarkTick TickHeight="10"'
 xaml,←⊂'                           DistanceFromScale="3" TickStyle="MajorTick" TickShape="Rectangle"'
 xaml,←⊂'                           TickWidth="2"/>'
 xaml,←⊂'                   </sfg:LinearScale.Ticks>'
 xaml,←⊂'                   <sfg:LinearScale.Pointers>'
 xaml,←⊂'                       <sfg:LinearBarPointer Name="lg_pointer" '
 xaml,←⊂'                           PointerWidth="10"'
 xaml,←⊂'                           />'
 xaml,←⊂'                   </sfg:LinearScale.Pointers>'
 xaml,←⊂'               </sfg:LinearScale>'
 xaml,←⊂'           </sfg:LinearGauge.Scales>'
 xaml,←⊂'        </sfg:LinearGauge>'
 xaml,←⊂'        <Button Name="btnStop" Content="Stop"/>'
 xaml,←⊂'    </StackPanel>'

The more rational among you may wonder about ScaleDirection="CounterClockwise" - it's there to get the indicator illuminating from the bottom up.  Leave it out (or ScaleDirection="Clockwise") and the bar illuminates from the top down.  I despair.

And while we're at it I also don't know why a TickWidth of 2 is wider than a PointerWidth of 10.  Life's too short...


∇ LinearGauge;⎕IO;⎕ML;xaml;⎕USING
⍝ Simple LinearGauge example
 ⎕IO ⎕ML←0 3
 window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncGauge')
 ⎕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.

∇ LinearTick w;⎕IO;⎕ML
⍝ Set LinearPointerValue at each timer increment
 ⎕IO ⎕ML←0 3

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