首页 > 代码库 > wp8.1 C#技巧: 计时器

wp8.1 C#技巧: 计时器

public MainPage()
{
this.InitializeComponent();
this.timer = new DispatcherTimer();//新建委托时间实例
timer.Interval = new TimeSpan(0, 0, 0, 0, 200);//设置计时的刻度
timer.Tick += OnTimerTick;//监视增加计时间事件
timer.Start();//计时开始
}
void OnTimerTick(object sender, object e)
{
Data.Value += 0.2m;
this.txtValue.Text = string.Format("{0}s", Data.Value);
}
DispatcherTimer timer;

wp8.1 C#技巧: 计时器