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