0
我正在创建一个使用此计时器的健身应用程序:倒计时以准备自己(5秒),然后进行锻炼倒计时(20秒)和休息倒计时(10秒)。锻炼和休息倒计时是为了循环8完成前。这是我现在所拥有的。我不知道在哪里放置环路或它需要的条件。任何帮助?如何在IF语句中循环?
while (rounds > 0 && rounds < 9)
{
if (prepTicks > 0)
{
txtblPrepare.Visibility = System.Windows.Visibility.Visible;
txtblGo.Visibility = System.Windows.Visibility.Collapsed;
txtblTime.Text = prepTicks + " Seconds Remaining";
prepTicks--;
}
else if (workTick > 0)
{
txtblPrepare.Visibility = System.Windows.Visibility.Collapsed;
txtblGo.Visibility = System.Windows.Visibility.Visible;
txtblTime.Text = workTick + " Seconds Remaining";
workTick--;
}
else if (restTicks > 0)
{
txtblGo.Visibility = System.Windows.Visibility.Collapsed;
txtblRest.Visibility = System.Windows.Visibility.Visible;
txtblTime.Text = restTicks + " Seconds Remaining";
restTicks--;
}
else
{
txtblRest.Text = "Congratulations";
txtblTime.Text = "Times Up";
}
rounds++;
}
txtblRoundNo.Text = rounds.ToString();
什么不行?具体... – 2014-12-27 14:31:38
为什么不使用3个独立的定时器来简化它。一个用于准备,一个用于锻炼,一个用于休息? – 2014-12-27 14:40:04
谢谢大家的帮助 – 2014-12-27 14:47:02