Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Talk:Implement timers in Windows Phone

From Wiki
Jump to: navigation, search


Atom217 - alternatively

using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using System.Windows.Threading;

namespace Timer {

   public partial class MainPage : PhoneApplicationPage
       DispatcherTimer timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(.1)};
       // Constructor
       public MainPage()
           this.timer.Tick+=new EventHandler(timer_Tick);
           this.Loaded += new RoutedEventHandler(timer_Tick);
       private void timer_Tick(object sender, EventArgs e)
           output.Text = DateTime.Now.ToLongTimeString();


MainPagexaml .cs

output is the name of the textblock

atom217 00:56, 25 March 2012 (EET)

Hamishwillee - Why this timer

Windows Phone has a number of different timers. It would be useful to explain why you're using this one, and its relative benefits/downsides when compared to other ones.

Hamishwillee - Thanks for the fixes

Thanks for the tidy up Matthew (and Chintan). Definitely an improvement.

hamishwillee 06:57, 11 February 2013 (EET)

Jweide - good example

Thank you, this was just what I needed.


jweide 15:24, 6 April 2013 (EEST)