improve:计时器逻辑
This commit is contained in:
@@ -207,16 +207,28 @@ namespace Ink_Canvas
|
|||||||
private void Digit3Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit3Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
minute += 10;
|
int currentMinute = minute;
|
||||||
if (minute >= 60) minute = 0;
|
int minuteTens = currentMinute / 10;
|
||||||
|
int minuteOnes = currentMinute % 10;
|
||||||
|
|
||||||
|
minuteTens++;
|
||||||
|
if (minuteTens >= 6) minuteTens = 0;
|
||||||
|
|
||||||
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit3Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit3Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
minute -= 10;
|
int currentMinute = minute;
|
||||||
if (minute < 0) minute = 50;
|
int minuteTens = currentMinute / 10;
|
||||||
|
int minuteOnes = currentMinute % 10;
|
||||||
|
|
||||||
|
minuteTens--;
|
||||||
|
if (minuteTens < 0) minuteTens = 5;
|
||||||
|
|
||||||
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,16 +236,28 @@ namespace Ink_Canvas
|
|||||||
private void Digit4Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit4Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
minute++;
|
int currentMinute = minute;
|
||||||
if (minute >= 60) minute = 0;
|
int minuteTens = currentMinute / 10;
|
||||||
|
int minuteOnes = currentMinute % 10;
|
||||||
|
|
||||||
|
minuteOnes++;
|
||||||
|
if (minuteOnes >= 10) minuteOnes = 0;
|
||||||
|
|
||||||
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit4Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit4Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
minute--;
|
int currentMinute = minute;
|
||||||
if (minute < 0) minute = 59;
|
int minuteTens = currentMinute / 10;
|
||||||
|
int minuteOnes = currentMinute % 10;
|
||||||
|
|
||||||
|
minuteOnes--;
|
||||||
|
if (minuteOnes < 0) minuteOnes = 9;
|
||||||
|
|
||||||
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,16 +265,28 @@ namespace Ink_Canvas
|
|||||||
private void Digit5Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit5Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
second += 10;
|
int currentSecond = second;
|
||||||
if (second >= 60) second = 0;
|
int secondTens = currentSecond / 10;
|
||||||
|
int secondOnes = currentSecond % 10;
|
||||||
|
|
||||||
|
secondTens++;
|
||||||
|
if (secondTens >= 6) secondTens = 0;
|
||||||
|
|
||||||
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit5Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit5Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
second -= 10;
|
int currentSecond = second;
|
||||||
if (second < 0) second = 50;
|
int secondTens = currentSecond / 10;
|
||||||
|
int secondOnes = currentSecond % 10;
|
||||||
|
|
||||||
|
secondTens--;
|
||||||
|
if (secondTens < 0) secondTens = 5;
|
||||||
|
|
||||||
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,16 +294,28 @@ namespace Ink_Canvas
|
|||||||
private void Digit6Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit6Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
second++;
|
int currentSecond = second;
|
||||||
if (second >= 60) second = 0;
|
int secondTens = currentSecond / 10;
|
||||||
|
int secondOnes = currentSecond % 10;
|
||||||
|
|
||||||
|
secondOnes++;
|
||||||
|
if (secondOnes >= 10) secondOnes = 0;
|
||||||
|
|
||||||
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit6Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit6Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (isTimerRunning) return;
|
if (isTimerRunning) return;
|
||||||
second--;
|
int currentSecond = second;
|
||||||
if (second < 0) second = 59;
|
int secondTens = currentSecond / 10;
|
||||||
|
int secondOnes = currentSecond % 10;
|
||||||
|
|
||||||
|
secondOnes--;
|
||||||
|
if (secondOnes < 0) secondOnes = 9;
|
||||||
|
|
||||||
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user