improve:计时器
This commit is contained in:
@@ -395,6 +395,7 @@ namespace Ink_Canvas
|
|||||||
// 第1位数字(小时十位)
|
// 第1位数字(小时十位)
|
||||||
private void Digit1Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit1Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentHour = hour;
|
int currentHour = hour;
|
||||||
int hourTens = currentHour / 10;
|
int hourTens = currentHour / 10;
|
||||||
int hourOnes = currentHour % 10;
|
int hourOnes = currentHour % 10;
|
||||||
@@ -404,16 +405,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
hour = hourTens * 10 + hourOnes;
|
hour = hourTens * 10 + hourOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit1Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit1Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentHour = hour;
|
int currentHour = hour;
|
||||||
int hourTens = currentHour / 10;
|
int hourTens = currentHour / 10;
|
||||||
int hourOnes = currentHour % 10;
|
int hourOnes = currentHour % 10;
|
||||||
@@ -423,17 +419,12 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
hour = hourTens * 10 + hourOnes;
|
hour = hourTens * 10 + hourOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第2位数字(小时个位)
|
// 第2位数字(小时个位)
|
||||||
private void Digit2Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit2Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentHour = hour;
|
int currentHour = hour;
|
||||||
int hourTens = currentHour / 10;
|
int hourTens = currentHour / 10;
|
||||||
int hourOnes = currentHour % 10;
|
int hourOnes = currentHour % 10;
|
||||||
@@ -448,16 +439,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
hour = hourTens * 10 + hourOnes;
|
hour = hourTens * 10 + hourOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit2Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit2Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentHour = hour;
|
int currentHour = hour;
|
||||||
int hourTens = currentHour / 10;
|
int hourTens = currentHour / 10;
|
||||||
int hourOnes = currentHour % 10;
|
int hourOnes = currentHour % 10;
|
||||||
@@ -472,17 +458,12 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
hour = hourTens * 10 + hourOnes;
|
hour = hourTens * 10 + hourOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第3位数字(分钟十位)
|
// 第3位数字(分钟十位)
|
||||||
private void Digit3Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit3Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentMinute = minute;
|
int currentMinute = minute;
|
||||||
int minuteTens = currentMinute / 10;
|
int minuteTens = currentMinute / 10;
|
||||||
int minuteOnes = currentMinute % 10;
|
int minuteOnes = currentMinute % 10;
|
||||||
@@ -492,16 +473,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
minute = minuteTens * 10 + minuteOnes;
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit3Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit3Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentMinute = minute;
|
int currentMinute = minute;
|
||||||
int minuteTens = currentMinute / 10;
|
int minuteTens = currentMinute / 10;
|
||||||
int minuteOnes = currentMinute % 10;
|
int minuteOnes = currentMinute % 10;
|
||||||
@@ -511,17 +487,12 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
minute = minuteTens * 10 + minuteOnes;
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第4位数字(分钟个位)
|
// 第4位数字(分钟个位)
|
||||||
private void Digit4Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit4Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentMinute = minute;
|
int currentMinute = minute;
|
||||||
int minuteTens = currentMinute / 10;
|
int minuteTens = currentMinute / 10;
|
||||||
int minuteOnes = currentMinute % 10;
|
int minuteOnes = currentMinute % 10;
|
||||||
@@ -536,16 +507,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
minute = minuteTens * 10 + minuteOnes;
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit4Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit4Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentMinute = minute;
|
int currentMinute = minute;
|
||||||
int minuteTens = currentMinute / 10;
|
int minuteTens = currentMinute / 10;
|
||||||
int minuteOnes = currentMinute % 10;
|
int minuteOnes = currentMinute % 10;
|
||||||
@@ -560,17 +526,12 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
minute = minuteTens * 10 + minuteOnes;
|
minute = minuteTens * 10 + minuteOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第5位数字(秒十位)
|
// 第5位数字(秒十位)
|
||||||
private void Digit5Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit5Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentSecond = second;
|
int currentSecond = second;
|
||||||
int secondTens = currentSecond / 10;
|
int secondTens = currentSecond / 10;
|
||||||
int secondOnes = currentSecond % 10;
|
int secondOnes = currentSecond % 10;
|
||||||
@@ -580,16 +541,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
second = secondTens * 10 + secondOnes;
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit5Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit5Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentSecond = second;
|
int currentSecond = second;
|
||||||
int secondTens = currentSecond / 10;
|
int secondTens = currentSecond / 10;
|
||||||
int secondOnes = currentSecond % 10;
|
int secondOnes = currentSecond % 10;
|
||||||
@@ -599,17 +555,12 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
second = secondTens * 10 + secondOnes;
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 第6位数字(秒个位)
|
// 第6位数字(秒个位)
|
||||||
private void Digit6Plus_Click(object sender, RoutedEventArgs e)
|
private void Digit6Plus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentSecond = second;
|
int currentSecond = second;
|
||||||
int secondTens = currentSecond / 10;
|
int secondTens = currentSecond / 10;
|
||||||
int secondOnes = currentSecond % 10;
|
int secondOnes = currentSecond % 10;
|
||||||
@@ -624,16 +575,11 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
second = secondTens * 10 + secondOnes;
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Digit6Minus_Click(object sender, RoutedEventArgs e)
|
private void Digit6Minus_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (isTimerRunning) return;
|
||||||
int currentSecond = second;
|
int currentSecond = second;
|
||||||
int secondTens = currentSecond / 10;
|
int secondTens = currentSecond / 10;
|
||||||
int secondOnes = currentSecond % 10;
|
int secondOnes = currentSecond % 10;
|
||||||
@@ -648,12 +594,6 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
second = secondTens * 10 + secondOnes;
|
second = secondTens * 10 + secondOnes;
|
||||||
UpdateDigitDisplays();
|
UpdateDigitDisplays();
|
||||||
|
|
||||||
// 如果计时器正在运行,重新计算剩余时间并继续计时
|
|
||||||
if (isTimerRunning && !isPaused)
|
|
||||||
{
|
|
||||||
UpdateSpecificTimeUnit(hour, minute, second);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图标数据常量
|
// 图标数据常量
|
||||||
|
|||||||
Reference in New Issue
Block a user