+@code {
+ private int Value = 0;
+ private Timer timer;
+
+ private const int IntervalDelay = 100;
+ private const int IntervalIncrement = 1;
+
+ protected override void OnInitialized()
+ {
+ timer = new Timer(IntervalDelay);
+ timer.Elapsed += OnTimerElapsed;
+ timer.AutoReset = true;
+ timer.Start();
+ }
+
+ private void OnTimerElapsed(object sender, ElapsedEventArgs e)
+ {
+ Value = Value < 42 ? Value + IntervalIncrement : 0;
+ InvokeAsync(StateHasChanged);
+ }
+
+ public void Dispose()
+ {
+ timer?.Stop();
+ timer?.Dispose();
+ }
+}
+