I want to write an app to show a countdown Timer. When I exit the application by pressing Home or search buttons timer will stop till I go back to the application. Here is my Code:
public Page1()
{
InitializeComponent();
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Start();
}
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
//Till timer is greater than 0 show timer.
}
How can I use the timer in a way that it keeps counting (running) even when I exited the application?