How to use timer

Please post public support tickets here. Note: for private support tickets, please send an email to instead.
Posts: 2
Joined: Thu Dec 29, 2016 3:59 am

How to use timer

Postby Arunchand » Thu Dec 29, 2016 4:02 am

I need to implement timer for auto referesh the html output.How to do it?

JS-Support @Userware
Site Admin
Posts: 1099
Joined: Tue Apr 08, 2014 3:42 pm

Re: How to use timer

Postby JS-Support @Userware » Thu Dec 29, 2016 7:48 am


Sure. Here is an example.

Simply put the code below in MainPage.xaml and MainPage.xaml.cs to check it out:


Code: Select all

<StackPanel Orientation="Horizontal">
   <Button Content="Click to Start" Background="#FFE44D26" Click="ButtonToStartTimer_Click"/>
   <Button Content="Click to Stop" Background="#FFE44D26" Click="ButtonToStopTimer_Click"/>
   <TextBlock Text="0" x:Name="CounterTextBlock" FontSize="26"/>


Code: Select all

_dispatcherTimer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 0, 0, 100) };
_dispatcherTimer.Tick += OnTick;

void ButtonToStartTimer_Click(object s, RoutedEventArgs e)

void ButtonToStopTimer_Click(object s, RoutedEventArgs e)

void OnTick(object s, object e)
   CounterTextBlock.Text = (int.Parse(CounterTextBlock.Text) + 1).ToString();


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 0 guests