【发布时间】:2015-06-19 08:03:55
【问题描述】:
我正在尝试为我的 Windows 商店应用程序创建一个计时器, 我已经能够更新秒数,但不是分钟, 分钟从组合框中获取其值
我在这里做错了什么?
public sealed partial class MainPage : Page
{
int secCount = 0;
DispatcherTimer timerCount = new DispatcherTimer();
TextBlock time = new TextBlock();
int m;
public MainPage()
{
this.InitializeComponent();
timerCount.Interval = new TimeSpan(0, 0, 0, 1, 0);
timerCount.Tick += new EventHandler<object>(timer_tick);
m = Convert.ToInt32(cMinutes.SelectedValue);
}
private void timer_tick(object sender, object e)
{
time.Text = cHours.SelectedItem + ":" + m + ":" + secCount;
timer.Children.Add(time); //timer is the main grid
secCount--;
if(secCount < 0)
{
secCount = 59;
m--;
}
}
【问题讨论】:
标签: c# windows visual-studio windows-phone-8 windows-store-apps