I am trying to build a clock application in Silverlight.
My application has multiple pages, one for analog, one for digital and one for a timer.
If I want to have a separate class that handles the time-keeping as follows:
private void startTimer()
{
DispatcherTimer myDispatcherTimer = new DispatcherTimer();
myDispatcherTimer.Interval = new TimeSpan(0,0,1);
myDispatcherTimer.Tick += new EventHandler(eachClick);
myDispatcherTimer.Start();
}
How can I get the current page that is displayed so that the method can use that page’s event handler?
What is the best way to go about this?
I dont really understand what exactly you’re trying to do. “How can I get the current page so that the method can use that page event handler?”
If you have three pages, and you’re trying to synchronize the time between all three of them, why dont you create a static Timer class.
I dont know, maybe something like this:
Then, from each page, just subscribe to the Tick event when you create it.